Commit Graph

29 Commits

Author SHA1 Message Date
Jan Beran
c8ec6573bc fix: Bump up pre-commit hooks version 2024-02-26 10:35:26 +01:00
Jan Beran
577a076bff feat: Use python-reorder-imports instead of isort 2024-01-31 09:13:42 +01:00
Frantisek Hrbata
1ba5757fed fix: do sbom manifest validation in post-commit
Following commit c3afbebf23 ("fix: bump esp-idf-sbom to v0.13.0 in pre-commit"),
the validation of submodule hash now relies solely on the information recorded
in the git-tree. Previously, the hash verification used submodule's
working tree hash if available. Since the new submodule hash is recorded
in git-tree only after the commit is created, we need to move the check
into post-commit, otherwise the hash validation checks the old value.

For example:

1. in .gitmodules

	[submodule "components/json/cJSON"]
	   sbom-hash = cb8693b058ba302f4829ec6d03f609ac6f848546

2. update the cJSON

	$ git -C components/json/cJSON checkout b45f48e600671feade0b6bd65d1c69de7899f2be

3. update cJSON hash in .gitmodules

	[submodule "components/json/cJSON"]
	   sbom-hash = b45f48e600671feade0b6bd65d1c69de7899f2be

4. commit the changes

	$ git commit -a -s

Step 4. will fail, because the validation is currently started in pre-commit stage,
where the hash for cJSON recorded in git-tree is still
cb8693b058ba302f4829ec6d03f609ac6f848546. The new hash b45f48e600671feade0b6bd65d1c69de7899f2be
will be stored in git-tree after the new commit is created.

Note that this means we cannot prevent the commit creation, but only
notify user about the hash inconsistency. If he/she still decides to
push it, it will fail in pre-commit checks in CI.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-19 12:34:36 +01:00
Frantisek Hrbata
ab3ed9ee44 fix: bump esp-idf-sbom to v0.13.0 in pre-commit
v0.13.0 contains fix for the submodule hash validation. Let's
bump its version in pre-commit, so the fix is used.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-13 07:31:37 +01:00
Frantisek Hrbata
22637ff824 feat: use esp-idf-sbom pre-commit plugin
Currently sbom manifest is checked only in .gitmodules and
this check is done in pre-commit and also in CI. Meaning it's running
three times(pre-commit before push if user has it enabled, in CI
as there is the pre-commit run again and again with test in CI). Since
esp-idf-sbom contains a full manifest validation support and pre-commit
plugin for it, let's use it. This removes all the current sbom testing
and replaces it with a signle pre-commit plugin which validates all
manifests files(sbom.yml, idf_component.yml, .gitmodules and also
referenced manifests) in repository. Note that this checks all
manifests, not only ones which were modified. The check is reasonably
fast though, so it should not cause any problem. The reason for
validating all manifest files is that we want to make sure that the sbom
information in .gitmodules is updated too and that the hash
recorded in .gitmodules is up-to-date. Meaning submodule update
would not trigger this plugin, because no manifest was changed.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
2023-12-07 14:53:18 +01:00
Sergei Silnov
b8b3dfc366 CI: update mypy for pre-commit 2023-02-27 10:06:10 +01:00
Fu Hanxi
2684850a13 ci: fix isort py37 incompatible issue 2023-02-06 10:32:38 +08:00
David Cermak
9e307b1114 ci: Fix pre-commit hook per isort deps deprecation
isorts dependecy became deprecated. Fixed to use 5.12.0 version of isort pre-commit
2023-02-02 10:07:32 +01:00
Marius Vikhammer
43a411d452 precommit: update flake8 repo url to use github
Gitlab mirror repo has been deprecated.
2022-11-15 16:21:13 +08:00
Laukik Hase
9549f0026f
protobuf: Fix v4.21.0 (python) compatibility issue
- Added auto-generated protobuf files (proto-c and python to pre-commit hook ignore lists
2022-06-07 15:59:40 +05:30
Roland Dobai
de136451f1 CI: Remove the copyright header check from the release branch 2021-11-01 12:44:10 +01:00
Roland Dobai
0c24913608 Tools: Permanently ignore some header files from header check 2021-10-19 14:41:50 +02:00
Fu Hanxi
0b7a0d7cbd ci: move check_tools_files_patterns to pre-commit 2021-10-13 09:13:33 +08:00
Jan Brudný
3ce35ae455 tools: precommit copyright check fails on windows 2021-09-23 22:47:56 +08:00
Jan Brudný
798a174686 Add copyright check to pre-commit-config 2021-09-20 17:50:55 +08:00
Michael (XIAO Xufeng)
7f2973f702 ci: put file sorter to the end of the pre-commit checking
So that the sorter will be done at the end of the checking flow, we don't need to run pre-commit hooks again if another hook also take effect.
2021-04-26 15:58:03 +08:00
Tomas Sebestik
e408915ff0 Remove sorting of MYPY ignore list from py script
Add sorting of mypy ignore list to pre-cm hook 'file-contents-sorter'
2021-04-13 10:35:56 +02:00
No One
2e5a334831 ci: run c3 unit test when other unit test run
C3 unit test were only being ran by unit_test_esp32c3 label/title,
should also be trigger by unit_test label/title
2021-03-18 10:36:08 +08:00
Tomas Sebestik
a22597a2d6 Add mypy check to pre-commit-config 2021-02-25 07:05:43 +00:00
Fu Hanxi
80e86e7939 ci(pre-commit): check if rules is updated and valid 2021-02-10 14:50:07 +08:00
Fu Hanxi
f0ea7a505b style(editorconfig): add indent style for yaml 2021-02-10 14:48:51 +08:00
Fu Hanxi
a4f2206d4c pre-commit: Add double-quote-string-fixer and isort for python files 2021-01-20 10:38:17 +08:00
Angus Gratton
19b4f2452c pre-commit: Rearrange the YAML file to avoid the warning
Having a root level key that existed only to make an anchor led to a warning,
instead create the anchor in the first place the key was used and then reference
it later on.
2020-11-13 14:22:18 +11:00
Angus Gratton
e2614122d8 pre-commit: Exclude expected output files from whitespace fixes
These rely on exact whitespace in their content
2020-11-11 07:36:35 +00:00
Angus Gratton
f7d58aa359 cmake: Disable cmakelint indentation checks temporarily 2020-11-09 13:59:43 +11:00
Angus Gratton
4fe78185b2 pre-commit: Use cmakelint 1.4.1 not older commit 2020-11-09 10:06:05 +11:00
Fu Hanxi
7ab18c7571 Fix windows error by upgrading pre-commit-hook version.
drop python 2.7 support. Now we only support python 3.6.1+
2020-11-04 10:24:42 +08:00
Fu Hanxi
47a97d2b52 check_kconfigs and check_deprecated_kconfigs now use files arguments 2020-11-02 15:49:13 +08:00
Fu Hanxi
bcc8f2628c CI: Add pre-commit for esp-idf project.
add tools/ci/python_packages/idf_ci.py for some util functions used in
ci and needs multi-os solution
2020-11-02 15:49:13 +08:00