1# See https://pre-commit.com for more information
2# See https://pre-commit.com/hooks.html for more hooks
3
4repos:
5  - repo: https://github.com/pre-commit/pre-commit-hooks
6    rev: v3.4.0
7    hooks:
8      - id: trailing-whitespace
9        # note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions
10        # items are:
11        # 1 - some file extensions
12        # 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always)
13        # 3 - any directory named 'testdata'
14        # 4 - IDF monitor test data
15        exclude: &whitespace_excludes |
16            (?x)^(
17                .+\.(md|rst|map|bin)|
18                .+test.*\/.*expected.*|
19                .+\/testdata\/.+|
20                .+test_idf_monitor\/tests\/.+
21            )$
22      - id: end-of-file-fixer
23        exclude: *whitespace_excludes
24      - id: check-executables-have-shebangs
25      - id: file-contents-sorter
26        files: 'tools/ci/executable-list.txt'
27      - id: mixed-line-ending
28        args: ['-f=lf']
29      - id: double-quote-string-fixer
30  - repo: https://gitlab.com/pycqa/flake8
31    rev: 3.8.4
32    hooks:
33      - id: flake8
34        args: ['--config=.flake8', '--tee', '--benchmark']
35  - repo: https://github.com/pycqa/isort
36    rev: 5.6.4
37    hooks:
38      - id: isort
39        name: isort (python)
40  - repo: local
41    hooks:
42      - id: check-executables
43        name: Check File Permissions
44        entry: tools/ci/check_executables.py --action executables
45        language: python
46        types: [executable]
47        exclude: '\.pre-commit/.+'
48      - id: check-executable-list
49        name: Validate executable-list.txt
50        entry: tools/ci/check_executables.py --action list
51        language: python
52        pass_filenames: false
53        always_run: true
54      - id: check-kconfigs
55        name: Validate Kconfig files
56        entry: tools/ci/check_kconfigs.py
57        language: python
58        files: '^Kconfig$|Kconfig.*$'
59      - id: check-deprecated-kconfigs-options
60        name: Check if any Kconfig Options Deprecated
61        entry: tools/ci/check_deprecated_kconfigs.py
62        language: python
63        files: 'sdkconfig\.ci$|sdkconfig\.rename$|sdkconfig.*$'
64      - id: cmake-lint
65        name: Check CMake Files Format
66        entry: cmakelint --linelength=120 --spaces=4 --filter=-whitespace/indent
67        language: python
68        additional_dependencies:
69          - cmakelint==1.4.1
70        files: 'CMakeLists.txt$|\.cmake$'
71        exclude: '\/third_party\/'
72      - id: check-codeowners
73        name: Validate Codeowner File
74        entry: tools/ci/check_codeowners.py ci-check
75        language: python
76        files: '\.gitlab/CODEOWNERS'
77        pass_filenames: false
78