forked from pact-foundation/pact-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
930a14a
commit ca11232
Showing
2 changed files
with
37 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
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,34 @@ | ||
#!/usr/bin/env python | ||
import re | ||
import sys | ||
import subprocess | ||
|
||
examples = """+ 61c8ca9 fix: navbar not responsive on mobile | ||
+ 479c48b test: prepared test cases for user authentication | ||
+ a992020 chore: moved to semantic versioning | ||
+ b818120 fix: button click even handler firing twice | ||
+ c6e9a97 fix: login page css | ||
+ dfdc715 feat(auth): added social login using twitter | ||
""" | ||
|
||
|
||
def main(): | ||
|
||
cmd = "git log --pretty=format:'%s' master..HEAD" | ||
commits = subprocess.check_output(cmd, shell=True) | ||
commits = commits.decode("utf-8").split('\n') | ||
for commit in commits: | ||
pattern = r'(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*' # noqa | ||
m = re.match(pattern, commit) | ||
if m is None: | ||
print("\nError with git message '{}' style".format(commit)) | ||
print("\nPlease change commit message to the conventional format and try to commit again. Examples:") # noqa | ||
|
||
print("\n" + examples) | ||
sys.exit(1) | ||
|
||
print("Commit messages valid") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |