Skip to content

Conversation

@martin4861
Copy link

@martin4861 martin4861 commented Sep 8, 2025

Add cppcheck as lint aspect as per #569.
A local test can be ran using: cd example; bazel lint //src:hello_cc
The aspect supports human readable output and xml output, e.g.
cd example; bazel build //... --aspects=//tools/lint:linters.bzl%cppcheck --output_groups=rules_lint_xml

Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

"Add cppcheck linter"

Test plan

  • Manual testing: cd example; bazel build //... --aspects=//tools/lint:linters.bzl%cppcheck --output_groups=rules_lint_xml: This will produce following output:
INFO: Analyzed 194 targets (0 packages loaded, 0 targets configured).
INFO: Found 194 targets...
Aspect //tools/lint:linters.bzl%cppcheck of //src:hello_cc up-to-date:
  bazel-bin/src/hello_cc.AspectRulesLintCppCheck.xml
Aspect //tools/lint:linters.bzl%cppcheck of //src/cpp/main:hello-greet up-to-date:
  bazel-bin/src/cpp/main/hello-greet.AspectRulesLintCppCheck.xml
Aspect //tools/lint:linters.bzl%cppcheck of //src:hello_c up-to-date:
  bazel-bin/src/hello_c.AspectRulesLintCppCheck.xml
Aspect //tools/lint:linters.bzl%cppcheck of //src/cpp/lib:hello-time up-to-date:
  bazel-bin/src/cpp/lib/hello-time.AspectRulesLintCppCheck.xml
Aspect //tools/lint:linters.bzl%cppcheck of //src/cpp/main:hello-world up-to-date:
  bazel-bin/src/cpp/main/hello-world.AspectRulesLintCppCheck.xml
INFO: Elapsed time: 0.227s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

@CLAassistant
Copy link

CLAassistant commented Sep 8, 2025

CLA assistant check
All committers have signed the CLA.

@aspect-workflows
Copy link

aspect-workflows bot commented Sep 8, 2025

Test

All tests were cache hits

5 tests (100.0%) were fully cached saving 2s.


Test

example

8 test targets passed

Targets
//tools/format:format_test_HTML_Jinja_with_djlint [k8-fastbuild]5s
//tools/format:format_test_JavaScript_with_prettier [k8-fastbuild]13s
//tools/format:format_test_Markdown_with_prettier [k8-fastbuild]2s
//tools/format:format_test_Protocol_Buffer_with_buf [k8-fastbuild]348ms
//tools/format:format_test_Python_with_ruff [k8-fastbuild]205ms
//tools/format:format_test_SQL_with_prettier [k8-fastbuild]1s
//tools/format:format_test_Scala_with_scalafmt [k8-fastbuild]3s
//tools/format:format_test_Starlark_with_buildifier [k8-fastbuild]236ms

Total test execution time was 25s. 33 tests (80.5%) were fully cached saving 14s.


Test (WORKSPACE) (Test)

example

8 test targets passed

Targets
//tools/format:format_test_HTML_Jinja_with_djlint [k8-fastbuild]3s
//tools/format:format_test_JavaScript_with_prettier [k8-fastbuild]5s
//tools/format:format_test_Markdown_with_prettier [k8-fastbuild]1s
//tools/format:format_test_Protocol_Buffer_with_buf [k8-fastbuild]579ms
//tools/format:format_test_Python_with_ruff [k8-fastbuild]232ms
//tools/format:format_test_SQL_with_prettier [k8-fastbuild]785ms
//tools/format:format_test_Scala_with_scalafmt [k8-fastbuild]4s
//tools/format:format_test_Starlark_with_buildifier [k8-fastbuild]242ms

Total test execution time was 15s. 13 tests (61.9%) were fully cached saving 8s.

@martin4861 martin4861 force-pushed the martin4861/add-cppcheck-linter branch from c13a79a to 65fc0a8 Compare September 18, 2025 14:40
@martin4861 martin4861 changed the title Add cppcheck lint aspect [WIP] feat: Add cppcheck lint aspect [WIP] Sep 18, 2025
@martin4861 martin4861 force-pushed the martin4861/add-cppcheck-linter branch 2 times, most recently from 6889850 to 47f06fa Compare September 19, 2025 09:08
@martin4861 martin4861 changed the title feat: Add cppcheck lint aspect [WIP] feat: Add cppcheck lint aspect Sep 19, 2025
@martin4861 martin4861 marked this pull request as ready for review September 19, 2025 09:11
@martin4861 martin4861 force-pushed the martin4861/add-cppcheck-linter branch 2 times, most recently from 2e6eb8a to 80a4062 Compare October 16, 2025 15:57
@martin4861 martin4861 force-pushed the martin4861/add-cppcheck-linter branch 5 times, most recently from 90f0027 to ee8a622 Compare November 14, 2025 13:21
@martin4861 martin4861 requested a review from thesayyn November 21, 2025 08:02
@martin4861 martin4861 force-pushed the martin4861/add-cppcheck-linter branch from 0503b1a to 998be32 Compare November 27, 2025 08:31
@martin4861 martin4861 requested a review from alexeagle November 27, 2025 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants