generated from rochacbruno/python-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#62: Add pre-commit hook to inspect commit message
- Loading branch information
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env ruby | ||
|
||
def check_message_format | ||
regex = /^#\d+:\s\w+/ | ||
message_file = ARGV[0] | ||
message = File.read(message_file) | ||
unless regex.match(message) | ||
puts "Your commit message is not formatted correctly" | ||
puts "Message should have following format: '#issue_id: Commit message'" | ||
puts "How to fix: https://github.com/k88hudson/git-flight-rules#i-wrote-the-wrong-thing-in-a-commit-message" | ||
exit 1 | ||
end | ||
end | ||
|
||
check_message_format |