You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2
run echo '#message' | npx commitlint
(results in error)
3
open .git/COMMIT_EDITMSG file and put there
#message
or make a commit git commit -m '#message'
4
run npx commitlint --edit --verbose
(result: found no problems; expected result: error)
This causes any commit message that starts with # to bypass linting when using commitlint in commit-msg hook!
Probably it happens because commitlint does not properly read .git/COMMIT_EDITMSG contents (message starting with # is regarded as comment?)
This defeats the purpose of using commitlint to enforce messages code style (especially when using ClickUp)
But whatever the code style is, anyone can bypass it just by prepending commit message with #, thus adding an offending commit to the history.
I think this can be fixed by special treating just for the first line of .git/COMMIT_EDITMSG when commitlint is used with --edit flag
Because when commit is made with 'git commit -m' it usually means that it is a one line message
To reproduce:
1 use config that should always return an error for any commit message:
2
run
echo '#message' | npx commitlint
(results in error)
3
open .git/COMMIT_EDITMSG file and put there
or make a commit
git commit -m '#message'
4
run
npx commitlint --edit --verbose
(result: found no problems; expected result: error)
This causes any commit message that starts with # to bypass linting when using commitlint in commit-msg hook!
Probably it happens because commitlint does not properly read .git/COMMIT_EDITMSG contents (message starting with # is regarded as comment?)
Your Environment
git version 2.32.0
@commitlint/[email protected]
node v14.17.5
The text was updated successfully, but these errors were encountered: