Tools: install-prereqs-ubuntu.sh: add support for Ubuntu Noble (24.04)
[ardupilot.git] / .pre-commit-config.yaml
blob9c15396246364aa4b602189a2210507ffcd1c565
1 # See https://pre-commit.com for more information, specially https://pre-commit.com/#pre-commit-run for manual trigger
2 # Some example useful invocations:
3 #  pre-commit run: this is what pre-commit runs by default when committing. This will run all hooks against currently staged files.
4 #  pre-commit run --all-files: run all the hooks against all the files. This is a useful invocation if you are using pre-commit in CI.
5 #  pre-commit run check-executables-have-shebangs: run the check-executables-have-shebangs hook against all staged files.
7 # Files or directory we want to excude from checking
8 exclude: |
9   (?x)(
10   ^modules/ |
11   ^build/ |
12   ^cmake-build-debug/ |
13   \.m |
14   ^libraries/AP_HAL_ChibiOS/hwdef/scripts/
15   )
17 repos:
18   -   repo: https://github.com/pre-commit/pre-commit-hooks
19       rev: v4.4.0
20       hooks:
21         #-   id: trailing-whitespace
22         #-   id: end-of-file-fixer
23         -   id: mixed-line-ending
24             name: Check line ending character (LF)
25             args: ["--fix=lf"]
26             types_or: [python, c, c++, shell]
27             exclude: |
28               (?x)^(
29                 libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.cpp |
30                 libraries/AP_ADSB/AP_ADSB_Sagetech_MXS.h
31               )$
32         -   id: check-added-large-files
33         -   id: check-executables-have-shebangs
34         -   id: check-shebang-scripts-are-executable
35             exclude: |
36               (?x)^(
37                 .*\/wscript |
38                 wscript
39               )$
40         -   id: check-merge-conflict
41         -   id: check-xml
42         -   id: check-yaml
44   -   repo: https://github.com/lsst-ts/pre-commit-xmllint
45       rev: 6f36260b537bf9a42b6ea5262c915ae50786296e
46       hooks:
47         - id: format-xmllint
48           files: libraries/AP_DDS/dds_xrce_profile.xml
49   -   repo: https://github.com/psf/black
50       rev: 23.7.0
51       hooks:
52         - id: black
53           files: |
54             (?x)^(
55               libraries\/AP_DDS\/(wscript|.*\.py)$ |
56               Tools/ros2/.*\.py
57             )$
59 # # Use to sort python imports by name and put system import first.
60 #   -   repo: https://github.com/pycqa/isort
61 #       rev: 5.12.0
62 #       hooks:
63 #         - id: isort
64 #           args: [--check-only]
65 #           name: isort (python)
67 # # Use to check python typing to show errors.
68 #   -   repo: https://github.com/pre-commit/mirrors-mypy
69 #       rev: 'v0.950'
70 #       hooks:
71 #         - id: mypy
72 #           args: [--no-strict-optional, --ignore-missing-imports]
73 #           additional_dependencies: [types-PyYAML, types-requests]