Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,15 @@ pre-commit install -t pre-commit -t commit-msg
With this command the library will take configuration from `.pre-commit-config.yaml` and will set up the hooks by us.


### Commit message style
Use the following commit message style. e.g:
```
'feat: TT-123 Applying some changes'
'fix: TT-321 Fixing something broken'
'feat(config): TT-00 Fix something in config files'
```
The value `TT-###` refers to the Jira issue that is being solved. Use TT-00 if the commit does not refer to any issue.

### Test
We are using [Pytest](https://docs.pytest.org/en/latest/index.html) for tests. The tests are located in the package
`tests` and use the [conventions for python test discovery](https://docs.pytest.org/en/latest/goodpractices.html#test-discovery).
Expand Down
8 changes: 4 additions & 4 deletions commons/git_hooks/enforce_semantic_commit_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
ERROR_MSG = """
Commit failed!
Please use semantic commit message format. Examples:
'feat: Applying some changes'
'fix: Fixing something broken'
'feat(config): Fix something in config files'
'feat: TT-123 Applying some changes'
'fix: TT-321 Fixing something broken'
'feat(config): TT-00 Fix something in config files'

For more details in commit message format, review https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits
"""

SUCCESS_MSG = "Commit succeed!. Semantic commit message is correct."

COMMIT_MSG_REGEX = r'(TT-)[0-9].*(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?:\s.*'
COMMIT_MSG_REGEX = r'(build|ci|docs|feat|fix|perf|refactor|style|test|chore|revert)(\([\w\-]+\))?: TT-[0-9]+ .*'

# Get the commit message file
commit_msg_file = open(sys.argv[1]) # The first argument is the file
Expand Down