2022-02-22 17:42:16 +03:00
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
|
|
repos:
|
2022-04-14 12:15:19 +03:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2022-02-22 17:42:16 +03:00
|
|
|
rev: v3.2.0
|
|
|
|
hooks:
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: trailing-whitespace
|
2024-08-29 18:03:19 +03:00
|
|
|
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: end-of-file-fixer
|
2024-08-29 18:03:19 +03:00
|
|
|
exclude: /test/.*$(?<!\.qlref)|.*\.patch$|.*\.qll?$
|
2022-02-24 12:55:53 +03:00
|
|
|
|
2022-04-14 12:15:19 +03:00
|
|
|
- repo: https://github.com/pre-commit/mirrors-clang-format
|
2024-01-25 15:57:10 +03:00
|
|
|
rev: v17.0.6
|
2022-02-22 17:42:16 +03:00
|
|
|
hooks:
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: clang-format
|
|
|
|
|
2022-06-23 18:05:21 +03:00
|
|
|
- repo: https://github.com/pre-commit/mirrors-autopep8
|
2024-09-16 15:03:48 +03:00
|
|
|
rev: v2.0.4
|
2022-06-23 18:05:21 +03:00
|
|
|
hooks:
|
|
|
|
- id: autopep8
|
2023-03-29 16:57:45 +03:00
|
|
|
files: ^misc/codegen/.*\.py
|
2022-06-23 18:05:21 +03:00
|
|
|
|
2024-04-24 16:49:48 +03:00
|
|
|
- repo: local
|
2023-06-30 14:05:40 +03:00
|
|
|
hooks:
|
|
|
|
- id: buildifier
|
2024-04-24 16:49:48 +03:00
|
|
|
name: Format bazel files
|
|
|
|
files: \.(bazel|bzl)
|
|
|
|
language: system
|
2024-08-23 18:26:05 +03:00
|
|
|
entry: bazel run //misc/bazel/buildifier
|
2024-04-24 16:49:48 +03:00
|
|
|
pass_filenames: false
|
2023-06-30 14:05:40 +03:00
|
|
|
|
2024-05-13 10:27:35 +03:00
|
|
|
# DISABLED: can be enabled by copying this config and installing `pre-commit` with `--config` on the copy
|
|
|
|
# - id: go-gen
|
|
|
|
# name: Check checked in generated files in go
|
|
|
|
# files: ^go/.*
|
|
|
|
# language: system
|
|
|
|
# entry: bazel run //go:gen
|
|
|
|
# pass_filenames: false
|
2024-04-24 18:04:57 +03:00
|
|
|
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: codeql-format
|
2022-02-22 17:42:16 +03:00
|
|
|
name: Fix QL file formatting
|
|
|
|
files: \.qll?$
|
|
|
|
language: system
|
|
|
|
entry: codeql query format --in-place
|
2022-02-24 12:55:53 +03:00
|
|
|
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: sync-files
|
2022-02-22 17:42:16 +03:00
|
|
|
name: Fix files required to be identical
|
2024-08-30 17:08:37 +03:00
|
|
|
files: \.(qll?|qhelp|swift|toml)$|^config/identical-files\.json$
|
2022-02-22 17:42:16 +03:00
|
|
|
language: system
|
|
|
|
entry: python3 config/sync-files.py --latest
|
|
|
|
pass_filenames: false
|
2022-02-24 12:55:53 +03:00
|
|
|
|
2022-04-14 12:15:19 +03:00
|
|
|
- id: qhelp
|
2022-02-24 12:55:53 +03:00
|
|
|
name: Check query help generation
|
|
|
|
files: \.qhelp$
|
|
|
|
language: system
|
|
|
|
entry: python3 misc/scripts/check-qhelp.py
|
2022-04-14 12:15:19 +03:00
|
|
|
|
|
|
|
- id: swift-codegen
|
|
|
|
name: Run Swift checked in code generation
|
2024-09-09 11:47:42 +03:00
|
|
|
files: ^misc/codegen/|^swift/(schema.py$|codegen/|.*/generated/|ql/lib/(swift\.dbscheme$|codeql/swift/elements)|ql/\.generated.list)
|
2022-04-14 12:15:19 +03:00
|
|
|
language: system
|
2022-06-20 18:45:07 +03:00
|
|
|
entry: bazel run //swift/codegen -- --quiet
|
2022-04-14 12:15:19 +03:00
|
|
|
pass_filenames: false
|
2022-04-26 19:22:40 +03:00
|
|
|
|
|
|
|
- id: swift-codegen-unit-tests
|
|
|
|
name: Run Swift code generation unit tests
|
2022-04-27 10:09:57 +03:00
|
|
|
files: ^swift/codegen/.*\.py$
|
2022-04-26 19:22:40 +03:00
|
|
|
language: system
|
2023-02-24 15:44:29 +03:00
|
|
|
entry: bazel test //misc/codegen/test
|
2022-04-26 19:22:40 +03:00
|
|
|
pass_filenames: false
|
2024-09-09 11:47:42 +03:00
|
|
|
|
|
|
|
- id: rust-codegen
|
|
|
|
name: Run Rust checked in code generation
|
|
|
|
files: ^misc/codegen/|^rust/(schema.py$|codegen/|.*/generated/|ql/lib/(rust\.dbscheme$|codeql/rust/elements)|\.generated.list)
|
|
|
|
language: system
|
|
|
|
entry: bazel run //rust/codegen -- --quiet
|
|
|
|
pass_filenames: false
|
2024-09-10 11:22:45 +03:00
|
|
|
|
|
|
|
- id: rust-lint
|
|
|
|
name: Run fmt and clippy on Rust code
|
|
|
|
files: ^rust/extractor/(.*rs|Cargo.toml)$
|
|
|
|
language: system
|
|
|
|
entry: python3 rust/lint.py
|
|
|
|
pass_filenames: false
|