2020-10-21 07:30:49 -04:00
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
|
|
|
|
|
|
repos:
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2021-09-08 11:38:14 -04:00
|
|
|
rev: v4.0.1
|
2020-10-21 07:30:49 -04:00
|
|
|
hooks:
|
|
|
|
- id: trailing-whitespace
|
2020-11-12 22:22:18 -05:00
|
|
|
# note: whitespace exclusions use multiline regex, see https://pre-commit.com/#regular-expressions
|
|
|
|
# items are:
|
|
|
|
# 1 - some file extensions
|
|
|
|
# 2 - any file matching *test*/*expected* (for host tests, if possible use this naming pattern always)
|
|
|
|
# 3 - any directory named 'testdata'
|
2023-01-16 07:44:37 -05:00
|
|
|
# 4 - protobuf auto-generated files
|
2020-11-12 22:22:18 -05:00
|
|
|
exclude: &whitespace_excludes |
|
2021-01-22 02:25:22 -05:00
|
|
|
(?x)^(
|
|
|
|
.+\.(md|rst|map|bin)|
|
|
|
|
.+test.*\/.*expected.*|
|
|
|
|
.+\/testdata\/.+|
|
2022-05-27 00:05:46 -04:00
|
|
|
.*_pb2.py|
|
|
|
|
.*.pb-c.h|
|
2022-08-06 00:44:52 -04:00
|
|
|
.*.pb-c.c|
|
|
|
|
.*.yuv
|
2021-01-22 02:25:22 -05:00
|
|
|
)$
|
2020-10-21 07:30:49 -04:00
|
|
|
- id: end-of-file-fixer
|
2020-11-12 22:22:18 -05:00
|
|
|
exclude: *whitespace_excludes
|
2020-10-21 07:30:49 -04:00
|
|
|
- id: check-executables-have-shebangs
|
|
|
|
- id: mixed-line-ending
|
|
|
|
args: ['-f=lf']
|
2020-12-20 23:42:29 -05:00
|
|
|
- id: double-quote-string-fixer
|
2022-11-15 00:33:02 -05:00
|
|
|
- repo: https://github.com/PyCQA/flake8
|
2022-08-10 03:01:57 -04:00
|
|
|
rev: 5.0.4
|
2020-10-21 07:30:49 -04:00
|
|
|
hooks:
|
|
|
|
- id: flake8
|
|
|
|
args: ['--config=.flake8', '--tee', '--benchmark']
|
2020-12-20 23:42:29 -05:00
|
|
|
- repo: https://github.com/pycqa/isort
|
2023-02-03 00:05:30 -05:00
|
|
|
rev: 5.11.5 # python 3.7 compatible
|
2020-12-20 23:42:29 -05:00
|
|
|
hooks:
|
|
|
|
- id: isort
|
|
|
|
name: isort (python)
|
2022-05-27 00:05:46 -04:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
2020-10-21 07:30:49 -04:00
|
|
|
- repo: local
|
|
|
|
hooks:
|
|
|
|
- id: check-executables
|
|
|
|
name: Check File Permissions
|
|
|
|
entry: tools/ci/check_executables.py --action executables
|
|
|
|
language: python
|
|
|
|
types: [executable]
|
|
|
|
exclude: '\.pre-commit/.+'
|
|
|
|
- id: check-executable-list
|
|
|
|
name: Validate executable-list.txt
|
|
|
|
entry: tools/ci/check_executables.py --action list
|
|
|
|
language: python
|
|
|
|
pass_filenames: false
|
|
|
|
always_run: true
|
|
|
|
- id: check-kconfigs
|
|
|
|
name: Validate Kconfig files
|
2020-10-30 05:28:24 -04:00
|
|
|
entry: tools/ci/check_kconfigs.py
|
2020-10-21 07:30:49 -04:00
|
|
|
language: python
|
2020-10-30 05:28:24 -04:00
|
|
|
files: '^Kconfig$|Kconfig.*$'
|
2020-10-21 07:30:49 -04:00
|
|
|
- id: check-deprecated-kconfigs-options
|
|
|
|
name: Check if any Kconfig Options Deprecated
|
2020-10-30 05:28:24 -04:00
|
|
|
entry: tools/ci/check_deprecated_kconfigs.py
|
2020-10-21 07:30:49 -04:00
|
|
|
language: python
|
2020-10-30 05:28:24 -04:00
|
|
|
files: 'sdkconfig\.ci$|sdkconfig\.rename$|sdkconfig.*$'
|
2020-10-21 07:30:49 -04:00
|
|
|
- id: cmake-lint
|
|
|
|
name: Check CMake Files Format
|
2020-11-08 21:59:18 -05:00
|
|
|
entry: cmakelint --linelength=120 --spaces=4 --filter=-whitespace/indent
|
2020-10-21 07:30:49 -04:00
|
|
|
language: python
|
|
|
|
additional_dependencies:
|
2020-11-08 18:06:05 -05:00
|
|
|
- cmakelint==1.4.1
|
2020-10-21 07:30:49 -04:00
|
|
|
files: 'CMakeLists.txt$|\.cmake$'
|
|
|
|
exclude: '\/third_party\/'
|
|
|
|
- id: check-codeowners
|
|
|
|
name: Validate Codeowner File
|
|
|
|
entry: tools/ci/check_codeowners.py ci-check
|
|
|
|
language: python
|
2021-11-11 03:59:54 -05:00
|
|
|
always_run: true
|
2020-10-21 07:30:49 -04:00
|
|
|
files: '\.gitlab/CODEOWNERS'
|
|
|
|
pass_filenames: false
|
2021-02-08 23:34:16 -05:00
|
|
|
- id: check-rules-yml
|
|
|
|
name: Check rules.yml all rules have at lease one job applied, all rules needed exist
|
|
|
|
entry: tools/ci/check_rules_yml.py
|
|
|
|
language: python
|
2023-01-04 23:51:45 -05:00
|
|
|
files: '\.gitlab/ci/.+\.yml|\.gitlab-ci.yml|\.gitmodules'
|
2021-02-08 23:34:16 -05:00
|
|
|
pass_filenames: false
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
|
|
|
- id: check-generated-rules
|
|
|
|
name: Check rules are generated (based on .gitlab/ci/dependencies/dependencies.yml)
|
2022-10-09 01:10:59 -04:00
|
|
|
entry: tools/ci/generate_rules.py
|
2021-02-08 23:34:16 -05:00
|
|
|
language: python
|
2022-10-12 03:42:22 -04:00
|
|
|
files: '\.gitlab/ci/dependencies/.+|\.gitlab/ci/.*\.yml'
|
2021-02-08 23:34:16 -05:00
|
|
|
pass_filenames: false
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
2021-02-01 03:18:16 -05:00
|
|
|
- id: mypy-check
|
|
|
|
name: Check type annotations in python files
|
|
|
|
entry: tools/ci/check_type_comments.py
|
2021-09-08 11:38:14 -04:00
|
|
|
additional_dependencies:
|
2022-04-25 16:55:28 -04:00
|
|
|
- 'mypy==0.940'
|
2021-09-08 11:38:14 -04:00
|
|
|
- 'mypy-extensions==0.4.3'
|
2022-04-26 10:32:06 -04:00
|
|
|
- 'types-setuptools==57.4.14'
|
2022-05-23 02:50:37 -04:00
|
|
|
- 'types-PyYAML==0.1.9'
|
2022-05-27 00:05:46 -04:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
2021-02-01 03:18:16 -05:00
|
|
|
language: python
|
|
|
|
types: [python]
|
2022-02-01 13:11:46 -05:00
|
|
|
- id: check-requirement-files
|
|
|
|
name: Check requirement files
|
|
|
|
entry: tools/ci/check_requirement_files.py
|
|
|
|
additional_dependencies:
|
|
|
|
- 'jsonschema'
|
|
|
|
language: python
|
|
|
|
files: 'tools/requirements.+|tools/requirements/.+'
|
|
|
|
pass_filenames: false
|
2021-10-11 22:47:28 -04:00
|
|
|
- id: check-tools-files-patterns
|
|
|
|
name: Check tools dir files patterns
|
|
|
|
entry: tools/ci/check_tools_files_patterns.py
|
|
|
|
language: python
|
|
|
|
files: '^tools/.+'
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
|
|
|
pass_filenames: false
|
2021-11-05 05:23:24 -04:00
|
|
|
- id: check-generated-soc-caps-kconfig
|
|
|
|
name: Check soc caps kconfig files are generated (based on components/soc/IDF_TARGET/include/soc/soc_caps.h)
|
2023-02-06 06:23:10 -05:00
|
|
|
entry: tools/gen_soc_caps_kconfig/gen_soc_caps_kconfig.py -d 'components/soc/*/include/soc/' 'components/esp_rom/*/' 'components/spi_flash/*/'
|
2021-11-05 05:23:24 -04:00
|
|
|
language: python
|
2023-02-06 06:23:10 -05:00
|
|
|
files: 'components/soc/.+/include/soc/.+_caps\.h|components/esp_rom/.+/.+_caps\.h|kconfig\.soc_caps.in|components/spi_flash/.+/.+_caps\.h'
|
2021-11-05 05:23:24 -04:00
|
|
|
pass_filenames: false
|
|
|
|
additional_dependencies:
|
|
|
|
- pyparsing
|
2022-07-11 01:43:45 -04:00
|
|
|
- id: check-all-apps-readmes
|
|
|
|
name: Check if all apps readme files match given .build-test-rules.yml files. Modify the supported target tables
|
|
|
|
entry: tools/ci/check_build_test_rules.py check-readmes
|
|
|
|
language: python
|
2023-04-20 23:37:14 -04:00
|
|
|
files: 'tools/test_apps/.+|examples/.+|components/.+|tools/idf_py_actions/constants.py|tools/ci/check_build_test_rules.py'
|
|
|
|
require_serial: true
|
2022-07-11 01:43:45 -04:00
|
|
|
additional_dependencies:
|
2022-09-06 02:58:16 -04:00
|
|
|
- PyYAML == 5.3.1
|
2023-05-23 22:53:57 -04:00
|
|
|
- idf_build_apps~=1.0
|
2022-07-11 01:43:45 -04:00
|
|
|
- id: sort-build-test-rules-ymls
|
|
|
|
name: sort .build-test-rules.yml files
|
|
|
|
entry: tools/ci/check_build_test_rules.py sort-yaml
|
|
|
|
language: python
|
|
|
|
files: '\.build-test-rules\.yml'
|
|
|
|
additional_dependencies:
|
2022-09-06 02:58:16 -04:00
|
|
|
- PyYAML == 5.3.1
|
2022-07-11 01:43:45 -04:00
|
|
|
- ruamel.yaml
|
2023-06-12 07:06:41 -04:00
|
|
|
- id: submodule-sbom-hash-check
|
|
|
|
name: Check if sbom-hash values for submodules in .gitmodules match submodules checkout hash in git tree
|
|
|
|
entry: python tools/test_sbom/test_submodules.py
|
|
|
|
language: python
|
|
|
|
always_run: true
|
|
|
|
pass_filenames: false
|
2021-04-26 03:58:03 -04:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2021-09-08 11:38:14 -04:00
|
|
|
rev: v4.0.1
|
2021-04-26 03:58:03 -04:00
|
|
|
hooks:
|
|
|
|
- id: file-contents-sorter
|
2021-11-18 12:21:52 -05:00
|
|
|
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt)'
|
2022-06-23 10:39:12 -04:00
|
|
|
- repo: https://github.com/espressif/check-copyright/
|
2023-07-19 08:56:02 -04:00
|
|
|
rev: v1.0.3
|
2022-06-23 10:39:12 -04:00
|
|
|
hooks:
|
|
|
|
- id: check-copyright
|
|
|
|
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
|
2023-05-31 03:39:51 -04:00
|
|
|
- repo: https://github.com/espressif/conventional-precommit-linter
|
2023-07-31 06:48:14 -04:00
|
|
|
rev: v1.2.1
|
2023-05-31 03:39:51 -04:00
|
|
|
hooks:
|
|
|
|
- id: conventional-precommit-linter
|
|
|
|
stages: [commit-msg]
|