-
Notifications
You must be signed in to change notification settings - Fork 10
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
A new rule that makes sure the user have explained the reason of reverting #68
base: master
Are you sure you want to change the base?
A new rule that makes sure the user have explained the reason of reverting #68
Conversation
This PR should also remove one TODO line from commitling.config.ts. |
cfe2d56
to
ac427b8
Compare
@realmarv let's now rebase this PR 🙏 |
e9a1695
to
c9d6354
Compare
fc8a9b3
to
45e9e17
Compare
Done |
e1c6413
to
5d52748
Compare
5d52748
to
ddaa2f9
Compare
when: string | ||
) { | ||
let offence = false; | ||
let isRevertCommitMessage = headerStr.toLowerCase().includes("revert"); |
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.
@realmarv shouldn't it be "startsWith" instead of "includes"?
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.
If someone changes the commit title isn't it possible that "revert" word comes somewhere else in the title?
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.
Yes, in which would mean that the revert message used is not default, so if when=never, then offence should be false in this case.
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.
I added a test for this case
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.
cool, but why do I still see the use of includes()?
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.
Because this variable is checking if the commit message is a revert commit message not if it's a default revert message
5187a83
to
560b21f
Compare
commitlint/helpers.ts
Outdated
@@ -37,6 +37,14 @@ export abstract class Helpers { | |||
return text as string; | |||
} | |||
|
|||
public static assertWhen(when: string) { | |||
if (when !== "never" && when !== "always") { |
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.
@realmarv I've realised we should create an enum called "When" that has both When.Never and When.Always (but instead of mapping to int, they map to string); hopefully typescript supports this?
Let's rebase this PR to get rid of the red CI. |
50de12e
to
49650eb
Compare
78d319a
to
639f132
Compare
d1bd1c2
to
908c11d
Compare
c5fb9d5
to
18898b7
Compare
Add failing tests for default-revert-message rule.
Add default-revert-message rule.
639f132
to
db4c07b
Compare
a5cb5c6
to
81f50e3
Compare
Replaced #32