Commit Graph

4 Commits

Author SHA1 Message Date
Idan Horowitz
028dad6e87 Meta: Add a post-commit commit message linter hook
This should help with getting commit messages tidy before they pass
through CI's commit linter :^)

For this hook to work pre-commit has to be explicitly installed via:
`pre-commit install --hook-type commit-msg`
2021-05-02 16:28:01 +02:00
Brian Gianforcaro
f91bfe8009 Meta: pre-commit should run lint-ports.py only when Ports change
Most of the existing lint-ing shell scripts have the ability
to only run on the files which have actually changed.
The new port lint-ing script doesn't have this functionality
unfortunately. This forces us to lint ALL the ports on every
single change to any other file in the system if you have
the pre-commit hook setup for your git clone locally.

Instead we can use pre-commit's feature to only run a hook
if certain files have changed to reduce the situations in
which we would run the Meta/lint-ports.py script.
2021-04-30 21:24:22 +02:00
Linus Groh
51bcfb5a44 Meta: Update lint-{clang-format,shell-scripts}.sh to take a list of files
This should speed up pre-commit a bit as only files that are staged will
be processed, and clang-format and shellcheck are only invoked once, not
for every file. When no arguments are given (e.g. on CI), it still uses
'git ls-files'.
2020-12-27 21:25:27 +01:00
Linus Groh
ac2358ff0d Meta: Add .pre-commit-config.yaml
This pre-commit config is quite simple: all it does for now is running
the already existing Meta/lint-ci.sh script to ensure no changes that
won't pass the CI linting step are committed.
Consequently pass_filenames is set to false, as these scripts will
determine which files to check themselves - should this ever become a
performance bottleneck, we can update them to accept an optional list of
filenames.

It should be noted that using pre-commit for Serenity development is by
no means a requirement, but doing so may decrease the number of CI
builds failing due to forgotten license headers etc. - especially if
you're pushing to `master` directly, rather than going through pull
requests *hint hint*.

For info how to install & use pre-commit, see https://pre-commit.com/.

Fixes #2365.
2020-12-09 21:04:07 +01:00