mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
add pre-commit configuration
This enables use of the `pre-commit` framework to run quick pre-commit checks. In particular this allows to automatically fix: * trailing white spaces * absence or multiple newlines at the end of files * QL code formatting * file sync More could be added in the future: anything that can be checked fast can be added in the configuration (for example well-formedness of `qldoc` files). This is a purely opt-in feature. Instructions for enabling it and possibly configuring its behaviour are in `pre-commit-hook-setup.md`.
This commit is contained in:
21
.pre-commit-config.yaml
Normal file
21
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v3.2.0
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: codeql-format
|
||||
name: Fix QL file formatting
|
||||
files: \.qll?$
|
||||
language: system
|
||||
entry: codeql query format --in-place
|
||||
- id: sync-files
|
||||
name: Fix files required to be identical
|
||||
language: system
|
||||
entry: python3 config/sync-files.py --latest
|
||||
pass_filenames: false
|
||||
Reference in New Issue
Block a user