-
Notifications
You must be signed in to change notification settings - Fork 2
check_formalities: allow fixup and squash commits #12
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,7 +90,7 @@ define() { | |
|
|
||
| define \ | ||
| -test 'Good commit' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
@@ -102,7 +102,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: double prefix' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'kernel: 6.18: add new feature' \ | ||
|
|
@@ -114,7 +114,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: double prefix and capitalized first word' \ | ||
| -expected '0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'kernel: 6.18: Add new feature' \ | ||
|
|
@@ -126,7 +126,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Bad check parsing test' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
@@ -142,7 +142,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Revert commit' \ | ||
| -expected '0 0 0 0 0 0 3 3 3 3 3 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 3 3 3 3 3 0 0 0 0 3' \ | ||
| -author 'Revert Author' \ | ||
| -email '[email protected]' \ | ||
| -subject "Revert 'package: add new feature'" \ | ||
|
|
@@ -152,10 +152,36 @@ define \ | |
| Signed-off-by: Revert Author <[email protected]> | ||
| EOF | ||
|
|
||
| # shellcheck disable=SC2016 | ||
| define \ | ||
| -test 'Fixup commit' \ | ||
| -expected '0 0 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'fixup! package: subject' \ | ||
| -body <<-'EOF' | ||
| This is a fixup commit. | ||
|
|
||
| Signed-off-by: Good Author <[email protected]> | ||
| EOF | ||
|
Comment on lines
+156
to
+166
|
||
|
|
||
| # shellcheck disable=SC2016 | ||
| define \ | ||
| -test 'Squash commit' \ | ||
| -expected '0 0 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'squash! package: subject' \ | ||
| -body <<-'EOF' | ||
| This is a squash commit. | ||
|
|
||
| Signed-off-by: Good Author <[email protected]> | ||
| EOF | ||
|
|
||
| # shellcheck disable=SC2016 | ||
| define \ | ||
| -test 'Body: malicious body shell injection' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: malicious body shell injection' \ | ||
|
|
@@ -167,7 +193,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: malicious body check injection' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: malicious body check injection' \ | ||
|
|
@@ -179,7 +205,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: missing Signed-off-by but check disabled' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 3 3 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 3 3 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on missing signed-off-by' \ | ||
|
|
@@ -188,7 +214,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: mismatched Signed-off-by but check disabled' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 3 3 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 3 3 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on mismatched signed-off-by' \ | ||
|
|
@@ -201,7 +227,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Bad author email (GitHub noreply)' \ | ||
| -expected '0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 3' \ | ||
| -expected '0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 3' \ | ||
| -author 'Bad Email' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on bad author email' \ | ||
|
|
@@ -213,7 +239,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: starts with whitespace' \ | ||
| -expected '0 0 0 0 0 0 1 1 3 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 1 1 3 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject ' package: subject starts with whitespace' \ | ||
|
|
@@ -225,7 +251,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: no prefix' \ | ||
| -expected '0 0 0 0 0 0 0 1 3 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 1 3 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'This subject has no prefix' \ | ||
|
|
@@ -237,7 +263,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: capitalized first word' \ | ||
| -expected '0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: Capitalized first word' \ | ||
|
|
@@ -249,7 +275,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: ends with a period' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: subject ends with a period.' \ | ||
|
|
@@ -261,7 +287,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: too long (hard limit)' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: this subject is way too long and should fail the hard limit check of 60 chars' \ | ||
|
|
@@ -273,15 +299,15 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: missing Signed-off-by' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 1 3 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 1 3 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on missing signed-off-by' \ | ||
| -body 'The Signed-off-by line is missing.' | ||
|
|
||
| define \ | ||
| -test 'Body: mismatched Signed-off-by' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 1 3 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 1 3 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on mismatched signed-off-by' \ | ||
|
|
@@ -293,15 +319,15 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: empty' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 3 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: fail on empty body' \ | ||
| -body 'Signed-off-by: Good Author <[email protected]>' | ||
|
|
||
| define \ | ||
| -test 'Author name is a single word' \ | ||
| -expected '0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 2 0 2 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Nickname' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: warn on single-word author name' \ | ||
|
|
@@ -313,7 +339,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Subject: too long (soft limit)' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: this subject is long and should trigger a warning' \ | ||
|
|
@@ -325,7 +351,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: line too long' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: warn on long body line' \ | ||
|
|
@@ -337,7 +363,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Body: line almost too long' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'test: pass on not too long body line' \ | ||
|
|
@@ -349,7 +375,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Exception: dependabot' \ | ||
| -expected '0 0 3 3 3 3 3 3 3 3 3 3 3 0 3 3' \ | ||
| -expected '0 0 0 3 3 3 3 3 3 3 3 3 3 3 0 3 3' \ | ||
| -author 'dependabot[bot]' \ | ||
| -email 'dependabot[bot]@users.noreply.github.com' \ | ||
| -subject 'CI: bump something from 1 to 2' \ | ||
|
|
@@ -360,7 +386,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'No exception: dependabot' \ | ||
| -expected '0 0 2 1 2 1 0 0 0 0 0 1 3 0 0 3' \ | ||
| -expected '0 0 0 2 1 2 1 0 0 0 0 0 1 3 0 0 3' \ | ||
| -author 'dependabot[bot]' \ | ||
| -email 'dependabot[bot]@users.noreply.github.com' \ | ||
| -subject 'CI: bump something from 1 to 2' \ | ||
|
|
@@ -370,7 +396,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Exception: weblate' \ | ||
| -expected '0 0 3 3 3 3 3 3 3 3 3 3 3 0 3 3' \ | ||
| -expected '0 0 0 3 3 3 3 3 3 3 3 3 3 3 0 3 3' \ | ||
| -author 'Hosted Weblate' \ | ||
| -email '[email protected]' \ | ||
| -subject 'Translated using Weblate (English)' \ | ||
|
|
@@ -381,7 +407,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'No exception: weblate' \ | ||
| -expected '0 0 0 0 0 0 0 1 3 0 0 1 3 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 1 3 0 0 1 3 0 0 3' \ | ||
| -author 'Hosted Weblate' \ | ||
| -email '[email protected]' \ | ||
| -subject 'Translated using Weblate (English)' \ | ||
|
|
@@ -400,7 +426,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'PR from master' \ | ||
| -expected '1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
@@ -415,7 +441,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Feature branch check disabled' \ | ||
| -expected '3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
@@ -428,7 +454,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Feature branch check enabled, PR from main fails' \ | ||
| -expected '1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
@@ -442,7 +468,7 @@ define \ | |
|
|
||
| define \ | ||
| -test 'Feature branch check enabled, PR from feature branch passes' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -expected '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3' \ | ||
| -author 'Good Author' \ | ||
| -email '[email protected]' \ | ||
| -subject 'package: add new feature' \ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe fixups could just
continue, same as for merge commits, while squash could do most checks? I thought fixups are just that, but squash commits can amend commit messages. So squash should pass all checks without thesquash!prefix. I haven't thought about this too deep to be honest.And maybe the check text should be something like: Pull request must not have any fixup or squash commits.