-
Notifications
You must be signed in to change notification settings - Fork 218
/
.pre-commit-config.yaml
72 lines (72 loc) · 2.37 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
minimum_pre_commit_version: 3.2.0 # necessitated by Lucas-C's hooks
default_install_hook_types: [pre-commit, pre-push]
exclude: 'thirdParty'
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v12.0.1
hooks:
- id: clang-format
types_or: [file]
files: \.(cpp|def|h|cu|tpp|kernel|loader|unitless|hpp|param)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: no-commit-to-branch
args: [-b, dev]
- id: check-merge-conflict
- id: trailing-whitespace
exclude_types: [markdown, rst]
- id: end-of-file-fixer
- id: check-toml
- id: check-yaml
- id: mixed-line-ending
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
exclude: \.tpl$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
- id: forbid-tabs
types_or: [file]
exclude_types: [rst, tex, tsv]
- id: remove-tabs
types_or: [file]
exclude_types: [rst, tex, tsv]
- id: forbid-crlf
- id: remove-crlf
- repo: https://github.com/brutus/enforce-ascii
rev: v0.2.1
hooks:
- id: enforce-ascii
types_or: [file]
exclude_types: [rst, tex, tsv, jupyter, markdown]
exclude: .zenodo.json
- repo: local
hooks:
- id: check_cpp_code_style
name: check_cpp_code_style
entry: share/ci/check_cpp_code_style.sh
language: system
files: \.(cpp|def|h|cu|tpp|kernel|loader|unitless|hpp|param)$
pass_filenames: false
# This hook runs on all files which is why it feels a bit too heavy-weight
# for running before every commit. The CI currently runs manually, so it's
# still running there and can be run manually and pre-push on demand.
# TODO: Adjust the script to take filenames, so that we can pass the
# filenames and speed things up before commits.
stages: [manual, pre-push]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.1
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
# Rule E721 is about using isinstance()
# but lib/python/picongpu/pypicongpu/rendering/renderer.py
# is strict about types. Could be solved locally but I think this is fine.
args: [ --fix, --ignore, E721]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
args: ["--line-length", "120"]