2020-10-21 11:30:49 +00:00
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.com/hooks.html for more hooks
|
|
|
|
|
2023-12-19 08:35:26 +00:00
|
|
|
default_stages: [commit]
|
2023-12-14 11:17:03 +00:00
|
|
|
|
2020-10-21 11:30:49 +00:00
|
|
|
repos:
|
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2024-02-06 12:29:55 +00:00
|
|
|
rev: v4.5.0
|
2020-10-21 11:30:49 +00:00
|
|
|
hooks:
|
|
|
|
- id: trailing-whitespace
|
2020-11-13 03:22:18 +00: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 12:44:37 +00:00
|
|
|
# 4 - protobuf auto-generated files
|
2020-11-13 03:22:18 +00:00
|
|
|
exclude: &whitespace_excludes |
|
2021-01-22 07:25:22 +00:00
|
|
|
(?x)^(
|
|
|
|
.+\.(md|rst|map|bin)|
|
|
|
|
.+test.*\/.*expected.*|
|
|
|
|
.+\/testdata\/.+|
|
2022-05-27 04:05:46 +00:00
|
|
|
.*_pb2.py|
|
|
|
|
.*.pb-c.h|
|
2022-08-06 04:44:52 +00:00
|
|
|
.*.pb-c.c|
|
2024-04-01 11:58:07 +00:00
|
|
|
.*.yuv|
|
|
|
|
.*.rgb
|
2021-01-22 07:25:22 +00:00
|
|
|
)$
|
2020-10-21 11:30:49 +00:00
|
|
|
- id: end-of-file-fixer
|
2020-11-13 03:22:18 +00:00
|
|
|
exclude: *whitespace_excludes
|
2020-10-21 11:30:49 +00:00
|
|
|
- id: check-executables-have-shebangs
|
|
|
|
- id: mixed-line-ending
|
|
|
|
args: ['-f=lf']
|
2020-12-21 04:42:29 +00:00
|
|
|
- id: double-quote-string-fixer
|
2023-09-18 05:02:04 +00:00
|
|
|
- id: no-commit-to-branch
|
|
|
|
name: Do not use more than one slash in the branch name
|
|
|
|
args: ['--pattern', '^[^/]*/[^/]*/']
|
|
|
|
- id: no-commit-to-branch
|
|
|
|
name: Do not use uppercase letters in the branch name
|
|
|
|
args: ['--pattern', '^[^A-Z]*[A-Z]']
|
2022-11-15 05:33:02 +00:00
|
|
|
- repo: https://github.com/PyCQA/flake8
|
2022-08-10 07:01:57 +00:00
|
|
|
rev: 5.0.4
|
2020-10-21 11:30:49 +00:00
|
|
|
hooks:
|
|
|
|
- id: flake8
|
|
|
|
args: ['--config=.flake8', '--tee', '--benchmark']
|
2024-01-09 18:52:15 +00:00
|
|
|
- repo: https://github.com/asottile/reorder-python-imports
|
|
|
|
rev: v3.12.0
|
2020-12-21 04:42:29 +00:00
|
|
|
hooks:
|
2024-01-09 18:52:15 +00:00
|
|
|
- id: reorder-python-imports
|
|
|
|
name: Reorder Python imports
|
|
|
|
args: [--py38-plus]
|
2022-05-27 04:05:46 +00:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
2024-03-25 04:57:55 +00:00
|
|
|
- repo: https://github.com/codespell-project/codespell
|
2024-06-04 07:46:28 +00:00
|
|
|
rev: v2.3.0
|
2024-03-25 04:57:55 +00:00
|
|
|
hooks:
|
|
|
|
- id: codespell
|
2020-10-21 11:30:49 +00: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-deprecated-kconfigs-options
|
|
|
|
name: Check if any Kconfig Options Deprecated
|
2020-10-30 09:28:24 +00:00
|
|
|
entry: tools/ci/check_deprecated_kconfigs.py
|
2020-10-21 11:30:49 +00:00
|
|
|
language: python
|
2020-10-30 09:28:24 +00:00
|
|
|
files: 'sdkconfig\.ci$|sdkconfig\.rename$|sdkconfig.*$'
|
2020-10-21 11:30:49 +00:00
|
|
|
- id: cmake-lint
|
|
|
|
name: Check CMake Files Format
|
2020-11-09 02:59:18 +00:00
|
|
|
entry: cmakelint --linelength=120 --spaces=4 --filter=-whitespace/indent
|
2020-10-21 11:30:49 +00:00
|
|
|
language: python
|
|
|
|
additional_dependencies:
|
2020-11-08 23:06:05 +00:00
|
|
|
- cmakelint==1.4.1
|
2020-10-21 11:30:49 +00: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 08:59:54 +00:00
|
|
|
always_run: true
|
2020-10-21 11:30:49 +00:00
|
|
|
files: '\.gitlab/CODEOWNERS'
|
|
|
|
pass_filenames: false
|
2021-02-09 04:34:16 +00:00
|
|
|
- id: check-generated-rules
|
|
|
|
name: Check rules are generated (based on .gitlab/ci/dependencies/dependencies.yml)
|
2022-10-09 05:10:59 +00:00
|
|
|
entry: tools/ci/generate_rules.py
|
2021-02-09 04:34:16 +00:00
|
|
|
language: python
|
2023-12-18 14:29:58 +00:00
|
|
|
files: '\.gitlab/ci/dependencies/.+|\.gitlab/ci/.*\.yml|.gitlab-ci.yml'
|
2021-02-09 04:34:16 +00:00
|
|
|
pass_filenames: false
|
2023-12-18 14:42:56 +00:00
|
|
|
require_serial: true
|
2021-02-09 04:34:16 +00:00
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
2021-02-01 08:18:16 +00:00
|
|
|
- id: mypy-check
|
|
|
|
name: Check type annotations in python files
|
|
|
|
entry: tools/ci/check_type_comments.py
|
2021-09-08 15:38:14 +00:00
|
|
|
additional_dependencies:
|
2024-05-07 07:16:54 +00:00
|
|
|
- 'mypy'
|
|
|
|
- 'mypy-extensions'
|
|
|
|
- 'types-setuptools'
|
|
|
|
- 'types-PyYAML'
|
2023-12-18 14:29:58 +00:00
|
|
|
- 'types-requests'
|
2022-05-27 04:05:46 +00:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
2021-02-01 08:18:16 +00:00
|
|
|
language: python
|
|
|
|
types: [python]
|
2022-02-01 18:11:46 +00: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-12 02:47:28 +00: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
|
2023-09-08 04:45:19 +00:00
|
|
|
- id: check-rules-components-patterns
|
|
|
|
name: check patterns-build_components in rules.yml
|
|
|
|
entry: tools/ci/check_rules_components_patterns.py
|
|
|
|
language: python
|
|
|
|
files: 'components/.+|.gitlab/ci/rules.yml'
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
|
|
|
pass_filenames: false
|
2021-11-05 09:23:24 +00: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 11:23:10 +00: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 09:23:24 +00:00
|
|
|
language: python
|
2023-02-06 11:23:10 +00: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 09:23:24 +00:00
|
|
|
pass_filenames: false
|
|
|
|
additional_dependencies:
|
|
|
|
- pyparsing
|
2022-07-11 05:43:45 +00: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-21 03:37:14 +00: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 05:43:45 +00:00
|
|
|
additional_dependencies:
|
2022-09-06 06:58:16 +00:00
|
|
|
- PyYAML == 5.3.1
|
2024-01-11 11:57:23 +00:00
|
|
|
- idf-build-apps~=2.0
|
2024-01-23 10:28:06 +00:00
|
|
|
- id: sort-yaml-files
|
|
|
|
name: sort yaml files
|
|
|
|
entry: tools/ci/sort_yaml.py
|
2022-07-11 05:43:45 +00:00
|
|
|
language: python
|
2024-01-24 07:48:32 +00:00
|
|
|
files: '\.build-test-rules\.yml$|known_generate_test_child_pipeline_warnings\.yml$'
|
2024-01-23 10:28:06 +00:00
|
|
|
additional_dependencies:
|
|
|
|
- ruamel.yaml
|
|
|
|
- id: sort-yaml-test
|
|
|
|
name: sort yaml test
|
|
|
|
entry: python -m unittest tools/ci/sort_yaml.py
|
|
|
|
language: python
|
|
|
|
files: 'tools/ci/sort_yaml\.py$'
|
2022-07-11 05:43:45 +00:00
|
|
|
additional_dependencies:
|
|
|
|
- ruamel.yaml
|
2023-08-04 19:21:23 +00:00
|
|
|
- id: check-build-test-rules-path-exists
|
|
|
|
name: check path in .build-test-rules.yml exists
|
|
|
|
entry: tools/ci/check_build_test_rules.py check-exist
|
|
|
|
language: python
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
|
|
|
always_run: true
|
|
|
|
pass_filenames: false
|
|
|
|
require_serial: true
|
2023-08-03 00:31:11 +00:00
|
|
|
- id: cleanup-ignore-lists
|
|
|
|
name: Remove non-existing patterns from ignore lists
|
|
|
|
entry: tools/ci/cleanup_ignore_lists.py
|
|
|
|
language: python
|
|
|
|
always_run: true
|
|
|
|
require_serial: true
|
2023-12-18 14:42:56 +00:00
|
|
|
- id: gitlab-yaml-linter
|
|
|
|
name: Check gitlab yaml files
|
|
|
|
entry: tools/ci/gitlab_yaml_linter.py
|
|
|
|
language: python
|
2024-04-09 10:31:01 +00:00
|
|
|
files: '\.gitlab-ci\.yml|\.gitlab/ci/.+\.yml|\.gitmodules'
|
2023-12-18 14:42:56 +00:00
|
|
|
pass_filenames: false
|
|
|
|
additional_dependencies:
|
|
|
|
- PyYAML == 5.3.1
|
2021-04-26 07:58:03 +00:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2021-09-08 15:38:14 +00:00
|
|
|
rev: v4.0.1
|
2021-04-26 07:58:03 +00:00
|
|
|
hooks:
|
|
|
|
- id: file-contents-sorter
|
2021-11-18 17:21:52 +00:00
|
|
|
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt)'
|
2022-06-23 14:39:12 +00:00
|
|
|
- repo: https://github.com/espressif/check-copyright/
|
2023-07-19 12:56:02 +00:00
|
|
|
rev: v1.0.3
|
2022-06-23 14:39:12 +00:00
|
|
|
hooks:
|
|
|
|
- id: check-copyright
|
|
|
|
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
|
2023-05-31 07:39:51 +00:00
|
|
|
- repo: https://github.com/espressif/conventional-precommit-linter
|
2024-04-05 10:17:27 +00:00
|
|
|
rev: v1.7.0
|
2023-05-31 07:39:51 +00:00
|
|
|
hooks:
|
|
|
|
- id: conventional-precommit-linter
|
|
|
|
stages: [commit-msg]
|
2022-09-08 06:48:30 +00:00
|
|
|
- repo: https://github.com/espressif/astyle_py.git
|
2023-11-23 10:08:15 +00:00
|
|
|
rev: v1.0.5
|
2022-09-08 06:48:30 +00:00
|
|
|
hooks:
|
|
|
|
- id: astyle_py
|
|
|
|
# If you are modifying astyle version, update tools/format.sh as well
|
2023-09-27 14:35:26 +00:00
|
|
|
args: ['--astyle-version=3.4.7', '--rules=tools/ci/astyle-rules.yml']
|
2023-09-05 09:09:52 +00:00
|
|
|
- repo: https://github.com/shellcheck-py/shellcheck-py
|
|
|
|
rev: v0.9.0.5
|
|
|
|
hooks:
|
|
|
|
- id: shellcheck
|
|
|
|
name: shellcheck bash
|
|
|
|
args: ['--shell', 'bash', '-x']
|
|
|
|
files: 'install.sh|export.sh'
|
|
|
|
- id: shellcheck
|
|
|
|
name: shellcheck dash (export.sh)
|
|
|
|
args: ['--shell', 'dash', '-x']
|
|
|
|
files: 'export.sh'
|
2023-12-05 09:06:05 +00:00
|
|
|
- repo: https://github.com/espressif/esp-idf-sbom.git
|
2023-12-12 11:26:34 +00:00
|
|
|
rev: v0.13.0
|
2023-12-05 09:06:05 +00:00
|
|
|
hooks:
|
|
|
|
- id: validate-sbom-manifest
|
2023-12-18 07:08:13 +00:00
|
|
|
stages: [post-commit]
|
2024-01-19 05:44:36 +00:00
|
|
|
- repo: https://github.com/sphinx-contrib/sphinx-lint
|
|
|
|
rev: v0.9.1
|
|
|
|
hooks:
|
|
|
|
- id: 'sphinx-lint'
|
|
|
|
name: Lint rST files in docs folder using Sphinx Lint
|
|
|
|
files: ^(docs/en|docs/zh_CN)/.*\.(rst|inc)$
|
2024-01-24 07:48:18 +00:00
|
|
|
- repo: https://github.com/espressif/esp-idf-kconfig.git
|
|
|
|
rev: v2.1.0
|
|
|
|
hooks:
|
|
|
|
- id: check-kconfig-files
|