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
| when: string | ||
| ) { | ||
| let offence = false; | ||
| let isRevertCommitMessage = headerStr.toLowerCase().includes("revert"); |
There was a problem hiding this comment.
@realmarv shouldn't it be "startsWith" instead of "includes"?
There was a problem hiding this comment.
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.
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.
I added a test for this case
There was a problem hiding this comment.
cool, but why do I still see the use of includes()?
There was a problem hiding this comment.
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
| } | ||
|
|
||
| public static assertWhen(when: string) { | ||
| if (when !== "never" && when !== "always") { |
There was a problem hiding this comment.
@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
|
Superseded by #190 |
Replaced #32