Skip to content

feat: enhance signoff check by adding message body and a better regex #141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 10, 2024

Conversation

jcfaracco
Copy link
Contributor

@jcfaracco jcfaracco commented Mar 9, 2024

This pull request adds some enhancements in commit-check code such as:

  • Extend the signoff check to the body of the commit. The vast majority of the signoffs are being added into the body and not only the subject. It should be also considered too.
  • Remove the reference of multiple commits in get_commits_info plus add the hash to verify it. In the future, it should be nice to check a range of commits and not only the HEAD. That's why this function was rebased a little bit to match what is exactly doing today.
  • Include the email check into the signoff default regex.

The current implementation of signoff policy check is considering only
the subject. This is wrong because the signoff line is added in the body
of a commit message.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
This name of the function is actualy wrong because it fetches only one
single commit. I also added a sha parameter to help in the future to
fetch older commits from the tree. Then, we can analyse multiple commits
as the original function name suggests.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Before this commit, the signoff regex only looks for the exact word.
This new proposal also checks if the commit has an email associated to
it.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
This commit just updates the command line that is called by
`get_commit_info` to reflect the latest changes.

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
Copy link
Contributor

@shenxianpeng shenxianpeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you so much for your great enhacement.

@shenxianpeng shenxianpeng changed the title Enhance signoff check by adding message body and a better regex. feat: enhance signoff check by adding message body and a better regex. Mar 10, 2024
@shenxianpeng shenxianpeng changed the title feat: enhance signoff check by adding message body and a better regex. feat: enhance signoff check by adding message body and a better regex Mar 10, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.01%. Comparing base (ed7be81) to head (21c136c).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #141      +/-   ##
==========================================
+ Coverage   98.00%   98.01%   +0.01%     
==========================================
  Files           7        7              
  Lines         250      252       +2     
==========================================
+ Hits          245      247       +2     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shenxianpeng shenxianpeng merged commit da3e2c0 into commit-check:main Mar 10, 2024
@shenxianpeng shenxianpeng added documentation Improvements or additions to documentation enhancement New feature or request minor A minor version bump and removed documentation Improvements or additions to documentation minor A minor version bump labels Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants