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-18 07:08:13 +00:00
|
|
|
default_stages: [commit]
|
|
|
|
|
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'
|
|
|
|
# 4 - IDF monitor test data
|
2022-05-27 04:05:46 +00:00
|
|
|
# 5 - 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
|
|
|
.+test_idf_monitor\/tests\/.+|
|
|
|
|
.*_pb2.py|
|
|
|
|
.*.pb-c.h|
|
|
|
|
.*.pb-c.c
|
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
|
2022-11-15 05:33:02 +00:00
|
|
|
- repo: https://github.com/PyCQA/flake8
|
2021-09-08 15:38:14 +00:00
|
|
|
rev: 3.9.2
|
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: [--py36-plus]
|
2022-05-27 04:05:46 +00:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
|
|
|
|
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-kconfigs
|
|
|
|
name: Validate Kconfig files
|
2020-10-30 09:28:24 +00:00
|
|
|
entry: tools/ci/check_kconfigs.py
|
2020-10-21 11:30:49 +00:00
|
|
|
language: python
|
2020-10-30 09:28:24 +00:00
|
|
|
files: '^Kconfig$|Kconfig.*$'
|
2020-10-21 11:30:49 +00:00
|
|
|
- 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
|
|
|
|
files: '\.gitlab/CODEOWNERS'
|
|
|
|
pass_filenames: false
|
2021-02-09 04:34:16 +00: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
|
|
|
|
files: '\.gitlab/ci/.+\.yml|\.gitlab-ci.yml'
|
|
|
|
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)
|
|
|
|
entry: .gitlab/ci/dependencies/generate_rules.py
|
|
|
|
language: python
|
2021-03-03 06:28:05 +00:00
|
|
|
files: '\.gitlab/ci/dependencies/.+|\.gitlab/ci/rules\.yml'
|
2021-02-09 04:34:16 +00:00
|
|
|
pass_filenames: false
|
|
|
|
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:
|
2022-05-11 13:20:01 +00:00
|
|
|
- 'mypy==1.0.1'
|
|
|
|
- 'mypy-extensions==1.0.0'
|
2022-05-27 04:05:46 +00:00
|
|
|
exclude: >
|
|
|
|
(?x)^(
|
|
|
|
.*_pb2.py
|
|
|
|
)$
|
2021-02-01 08:18:16 +00:00
|
|
|
language: python
|
|
|
|
types: [python]
|
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
|
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-01 11:31:10 +00:00
|
|
|
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt)'
|
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]
|