Conversation
1839ce0 to
788c41f
Compare
| echo "Commit \"$message\": message is too short" | ||
| fi | ||
|
|
||
| if [[ ! "$message" =~ add|fix|update|remove|improve ]]; then |
There was a problem hiding this comment.
One suggestion: the check is case-sensitive, so commit messages like "Add feature" or "Fix bug" might not pass. You could consider making the match case-insensitive
There was a problem hiding this comment.
Thanks for the suggestion! I updated the script to make the check case-insensitive.
DilyanaSt
left a comment
There was a problem hiding this comment.
The solution looks good and correctly implements the required checks for commit messages. I like how the script iterates through all commits and validates both length and required verbs.
One small suggestion: the check is case-sensitive, so messages like "Added feature" might not be handled as expected. You could consider making it case-insensitive.
IvoPetrevski
left a comment
There was a problem hiding this comment.
Works well although some commits trigger both cases and are printed on two lines. Might be better to combine the messages and print then on one line when that is the case. Otherwise it doesn't miss any commits that break the rules as far as I can tell.
|
The script is straightforward and easy to follow. I also like that it checks both the message length and whether one of the required verbs is present. |
| @@ -0,0 +1,11 @@ | |||
| #!/bin/bash | |||
|
|
|||
| git log --pretty=format:"%s" | while read -r message; do | |||
There was a problem hiding this comment.
nice use of piping into a while read
What I did
I added a bash script that goes through all commit messages and checks if they meet the requirements.
What it checks
How to test
Run the script in the repo and it will print messages that don’t follow the rules.
Related issue
closes #2