The clang-tidy.py wrapper offers a --source-exclude flag, exposed as
pw_toolchain_STATIC_ANALYSIS_SKIP_SOURCES_GLOBS, that allows not running
clang-tidy on some source files. This CL switches the flag from
glob patterns to regular expressions.
It turns out glob patterns are unsuitable for this use case because
source file paths typically look like:
third_party/googletest/googletest/src/gtest-death-test.cc
Ideally, we would like to filter out anything under `third_party`. The
comment on pw_toolchain_STATIC_ANALYSIS_SKIP_SOURCES_GLOBS suggests this
can be done with globs, _but it can't_: you can't create a glob that
matches all files under a top-level directory, and the example provided
in the comment ("third_party/**/*") actually does not work. At best you
can use subdirectories, i.e. "**/googletest/**/*" in this case. But
having to match subdirectories in this way is,
1. Error-prone: what if there's a googletest subdirectory outside
third_party that you _do_ want to include in the analysis?
2. Extremely verbose: for downstream projects, everything under
the `pigweed` top-level directory is effectively third-party code
that they don't want to run clang-tidy on. And pigweed has very
many subdirectories.
Unlike globs, regular expressions actually work here, as the CL
demonstrates.
As far as I know no downstream project uses clang-tidy yet, so this
change does not require updating them.
Bug: b/203828808
Change-Id: Icab776724da35d668ef38166c7cf0a3452dd316d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66484
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Ted Pudlik <tpudlik@google.com>
These checks are all fast, worthwhile, and currently pass.
Also update comment in static_analysis_toolchain.gni.
Runtime impact: On my workstation I ran,
for i in 1 2 3;
do gn clean out; gn gen out; time ninja -C out static_analysis;
done
with and without this change. The mean CPU time (user+sys) increased by
about 25%, from 559 s to 707 s. I think this is acceptable.
No-Docs-Update-Reason: We do not currently discuss in the documentation which clang-tidy checks are run for upstream pigweed itself.
Change-Id: If28652ecbd3ca6c876e6942d08d24a30717e8294
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/66440
Commit-Queue: Ted Pudlik <tpudlik@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
- Add the "static_analysis" group that runs clang-tidy to the default
build.
- Remove the "clang_tidy" presubmit step. Instead, have the
"static_analysis" step run clang-tidy and python.lint from GN.
- Fix a few clang-tidy warnings.
- Exclude mbedtls headers from checks.
Change-Id: Ied832e48c9ba46efaebb911ddb82ab0592944ee7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/64624
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Add a file to pass to the '--constraint' option of 'pip'. This allows
setup.cfg files to only set actual requirements on dependencies but
ensures the actual version retrieved for a given commit is always the
same.
Added a new command 'pw python-packages'. 'pw python-packages list'
writes the list of versions of installed packages to a file.
'pw python-packages diff' compares the list of installed packages to the
constraint file. If there are new packages or updates to package
versions 'pw python-packages diff' will fail.
Added an option to pw_env_setup, '--unpin-pip-packages'. If this is set
the constraint file defined in the top-level '.gn' file is ignored. This
should periodically be used to update versions of packages in the
constraint file.
Change-Id: I49337e029b0c5c82ac1414448d97d952d9df4dae
Bug: 459
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/58280
Pigweed-Auto-Submit: Rob Mohr <mohrr@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
- Write required environment variables to a batch file.
- Fix virtualenv bin path.
- Temporarily disable host_build and cargo steps on Windows.
- Update the python runner to work on Windows.
- Remove script_exectuable from the .gn file as it was added before
Pigweed had an env_setup and was used to point to the correct system
Python.
Change-Id: Ie4d0d0c5deb752c79ee5059dd812175775eae10c
This change adds Pigweed's first few (incomplete) modules: pw_build,
pw_status, and pw_toolchain. The main scaffolding for Pigweed's GN-based
build system is also included, with a root BUILDCONFIG and BUILD.gn file
defining a top-level modules build target.
Change-Id: I09599443d50696343d6c5b85853cb5cee3ce0026