Add a compliance check that allows to flag when a given file requires a
Python version higher than 3.10 (minimum supported version in Zephyr at
the time of writing) since not all Python scripts are tested against
3.10 in CI and we want to avoid introducing changes that could break
users.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Update to the latest version of ruff and generate linter and format
exclusions for current python files in tree.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Make sure we install packages with no issues, some of the issues being
reporting on packages we might install using pip:
Warn: Project is vulnerable to: PYSEC-2019-41 / GHSA-qfc5-mcwq-26q8
Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc
Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56
Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h
Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg
Warn: Project is vulnerable to: PYSEC-2017-74
Warn: Project is vulnerable to: GHSA-55x5-fj6c-h6m8
Warn: Project is vulnerable to: PYSEC-2014-9 / GHSA-57qw-cc2g-pv5p
Warn: Project is vulnerable to: PYSEC-2021-19 / GHSA-jq4v-f5q6-mjqq
Warn: Project is vulnerable to: GHSA-pgww-xf46-h92r
Warn: Project is vulnerable to: PYSEC-2022-230 / GHSA-wrxv-2j5q-m38w
Warn: Project is vulnerable to: PYSEC-2018-12 / GHSA-xp26-p53h-6h2p
Warn: Project is vulnerable to: PYSEC-2024-4 / GHSA-2mqj-m65w-jghx
Warn: Project is vulnerable to: PYSEC-2023-165 / GHSA-cwvm-v4w8-q58c
Warn: Project is vulnerable to: PYSEC-2022-42992 / GHSA-hcpj-qp55-gfph
Warn: Project is vulnerable to: PYSEC-2023-137 / GHSA-pr76-5cm5-w9cj
Warn: Project is vulnerable to: PYSEC-2023-161 / GHSA-wfm5-v35h-vwf4
Warn: Project is vulnerable to: GHSA-3f63-hfp8-52jq
Warn: Project is vulnerable to: GHSA-44wm-f244-xhp3
Warn: Project is vulnerable to: GHSA-56pw-mpj4-fxww
Warn: Project is vulnerable to: GHSA-j7hp-h8jx-5ppr
Warn: Project is vulnerable to: PYSEC-2023-175
Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h
Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6
Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf
Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc
Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f
Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm
Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52
Warn: Project is vulnerable to: GHSA-c6fm-rgw4-8q73
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Modify the requirements-compliance.txt to exclude python-magic from
windows system installation. On windows, the line:
""python-magic-bin; sys_platform == "win32""" already exists. Adding:
python-magic on windows creates issues where the check_compliance.py
script will either freeze or throw errors related to libmagic.
Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
The ruff linter and formatter should get a locked version to be installed
for compliance. This prevents new linter issues because of ruff updates
itself.
Ruff version 0.8.0 removed the deprecated UP027 rule so it's removed from
the ignore list.
Update the excludes file to match the actual reported issues.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Instead of maintaining two lists, use the requirements file for
installing compliance dependencies.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add a compliance test using ruff, for both linting and formatting of
newly added python files.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
ReStructuredText can sometimes be tricky to get right, especially for
folks that might be more familiar with Markdown.
This adds a Sphinx/RST linter to the compliance check script to help
catch common issues that can easily go unnoticed and cause rendering
issues.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add a new compliance check that reports any clang-format issues on
the git diff and prints a warning.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
PR #72592 made pylint to use json2 output format. However, this
format is introduced in pylint v3. This commit adds an appropriate
setting in the requirements file.
Signed-off-by: Maciej Perkowski <Maciej.Perkowski@nordicsemi.no>
Add a YAMLLint compliance check that uses the yamllint package to report
linting error on YAML files.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
junitparser has a bug that prevents it from working correctly when lxml
is not installed.
See this GH issue for more information:
https://github.com/weiwei/junitparser/issues/99
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
There is a breaking change in Junitparser 'TestCase.result' between
v1.x and v2.x.
Update check_compliance.py minimally to take into account this change.
This avoids relying on an outdated package.
Signed-off-by: Henri Xavier <datacomos@huawei.com>
The Python python-magic module that we install for compliance checks
requires libmagic to be installed on the system to work. This requires
extra OS packages on Ubuntu and macOS, and an extra wheel on Windows.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
junitparser version 2 is incompatible with check_compliance.py, it fails
like this:
File "./scripts/ci/check_compliance.py", line 295, in parse_kconfig
self.skip("Not a Zephyr tree (ZEPHYR_BASE unset)")
File "./scripts/ci/check_compliance.py", line 141, in skip
self.case.result = Skipped(msg, "skipped")
File "/usr/local/lib/python3.9/site-packages/junitparser/junitparser.py"
line 682, in result
for entry in value:
TypeError: 'Skipped' object is not iterable
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Running check_compliance on a PR before submitting it can avert
embarrassing mistakes. Ensure the packages needed to do so are
installed along with all the others.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>