Skip to content

Repository files navigation

cpp-linter

PyPI ci coverage part of cpp-linter

The Python command behind cpp-linter-action: it runs clang-format and clang-tidy on C and C++ files, locally or in other CI.

Website · Documentation · Get started · Discussions

Quick start

With the clang tools installed (see Limitations):

pip install cpp-linter
cpp-linter --version=21 --style=file --tidy-checks=''

Usage

For usage in a GitHub Actions workflow, see the cpp-linter/cpp-linter-action repository

For the description of supported Command Line Interface options, see the CLI documentation

Applying fixes

Passing the --fix option makes cpp-linter apply clang-format fixes in-place to any files that have formatting problems.

Note

--fix only applies clang-format fixes. clang-tidy fixes are not applied automatically.

Limitations

  • cpp-linter does not install the clang tools. Install them first, for example with clang-tools; without them, --version=21 falls back to whatever clang-format and clang-tidy are on your PATH.
  • It exits 0 even when checks fail, so it reports findings but does not fail a build.
  • Locally, --files-changed-only and --lines-changed-only read the local git diff. In other CI, check the whole repository (the default): most CI systems set CI=true, and with it those options ask the GitHub API for the changed files.

Contributing

To provide feedback (requesting a feature or reporting a bug) please post to issues. To contribute changes, see CONTRIBUTING.rst.

License

The scripts and documentation in this project are released under the MIT License.

About

cpp-linter core Python executable package

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

35 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages