7 Commits

Author SHA1 Message Date
Alexander Kuzmenkov
21a3f8206c Run python linter and formatter in CI
Helps find some errors and cosmetic problems.
2023-01-30 13:49:26 +04:00
Jacob Champion
f400c75b79 Tweak commit-msg hook's line character limits
The commit-msg hook was counting the end-of-line characters in the 50-
and 72-character limit, so commit messages had to be wrapped slightly
shorter in order to avoid the hook complaint. Strip the EOL characters
during the check instead.

Since we use universal newline handling during the file read, stripping
LF ('\n') should be enough to handle both Windows and Unix development
environments.
2022-06-21 13:04:42 -05:00
Jacob Champion
bab5cc101d Update commit-msg hook to Python 3
This git hook is copied automatically during CMake, and breaks commits
immediately afterwards if Python 2 isn't installed. Since Python 2 has
been end-of-life for a while now, take this chance to upgrade.
2022-06-21 13:04:27 -05:00
Sven Klemm
5695e32858 Fix syntax error in commit hook 2019-04-09 13:45:20 +02:00
Sven Klemm
0823498b25 Stop processing commit message on scissors line
The commit message template may include the actual diff to be
committed separated with a special scissors line. This patch adds
support for the scissors line to the commit hook otherwise
the diff content may trigger any of the rules.
2019-04-09 11:07:30 +02:00
Erik Nordström
18a8afd1f8 Add a gitignore for Git hook tests
Running the git hook tests will leave some Python byte code files
lying around. This change hides those using a gitignore file.
2019-04-08 14:01:00 +02:00
Erik Nordström
881e3729c4 Add a Git commit hook to validate commit messages
Our coding guidelines recommend following "The seven rules of a great
Git commit message" by Chris Beams:

https://chris.beams.io/posts/git-commit/

This change adds a Git commit hook that validates all Git commit
messages according to these rules (at least to the extent possible).
Currently, the hook simply prints a warning and a list of violations
in case of a non-conforming Git commit message. The commit is
otherwise accepted. This could be changed to entirely fail the commit,
or, via another hook, fail to push any code that is non-conformant.

The hook will be installed on a CMake run or when the hook source
changes.
2019-04-08 10:38:41 +02:00