Skip to content

Commit 11e2bc3

Browse files
committed
Respond to review comments.
1 parent 229ab76 commit 11e2bc3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/pre-commit-hook-setup.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# CodeQL pre-commit-hook setup
22

3-
As stated in [CONTRIBUTING](../CONTRIBUTING.md) all CodeQL files must be formatted according to our [CodeQL style guide](ql-style-guide.md). You can use our pre-commit hook to avoid committing incorrectly formatted code. To use it, simply copy the [pre-commit](../misc/scripts/pre-commit) script to `.git/modules/ql/hooks/pre-commit` and make sure that it is executable.
3+
As stated in [CONTRIBUTING](../CONTRIBUTING.md) all CodeQL files must be formatted according to our [CodeQL style guide](ql-style-guide.md). You can use our pre-commit hook to avoid committing incorrectly formatted code. To use it, simply copy the [pre-commit](../misc/scripts/pre-commit) script to `.git/modules/ql/hooks/pre-commit` and make sure that:
4+
5+
- The script is executable. On Linux and macOS this can be done using `chmod +x`.
6+
- The CodeQL CLI has in added to your `PATH`.
47

58
The script will abort a commit that contains incorrectly formatted code in .ql or .qll files and print an error message like:
69

710
```
811
> git commit -m "My commit."
9-
code/ql/cpp/ql/src/Options.qll would change by autoformatting.
10-
code/ql/cpp/ql/src/printAst.ql would change by autoformatting.
12+
ql/cpp/ql/src/Options.qll would change by autoformatting.
13+
ql/cpp/ql/src/printAst.ql would change by autoformatting.
1114
```
1215

1316
If you prefer to have the script automatically format the code (and not abort the commit), you can replace the line `codeql query format --check-only` with `codeql query format --in-place` (and `exit $exitVal` with `exit 0`).

0 commit comments

Comments
 (0)