Skip to main content

A simple runner for clang-tidy.

Project description

clang-tidier

A simple clang-tidy runner for C and C++ projects.

Installation

clang-tidier requires Python 3.8 or higher, as well as some version of clang-tidy visible on the system PATH.

pip3 install clang-tidier

Usage

clang-tidier is a command-line application

usage: clang-tidier [-h] [--version] [--include <regex> [<regex> ...]] [--exclude <regex> [<regex> ...]]
                    [--werror] [--threads <num>] [--batch num/denom] [--session | --no-session]
                    [--relative-paths | --no-relative-paths] [--fix | --no-fix]
                    [--plugins <path...> [<path...> ...]]
                    [compile_db_path]

clang-tidy runner for C and C++ projects.

positional arguments:
  compile_db_path       path to compile_commands.json, or a directory containing it (default: discover
                        automatically)

options:
  -h, --help            show this help message and exit
  --version             print the version and exit
  --include <regex> [<regex> ...]
                        regular expression to select source files.
  --exclude <regex> [<regex> ...]
                        regular expression to exclude source files.
  --werror              stop on the first file that emits warnings
  --threads <num>       number of threads to use.
  --batch num/denom     batch subdivisions.
  --session, --no-session
                        saves run information so subsequent re-runs may avoid re-scanning files.
  --relative-paths, --no-relative-paths
                        show paths as relative to CWD where possible.
  --fix, --no-fix       attempt to apply clang-tidy fixes where possible.
  --plugins <path...> [<path...> ...]
                        one or more plugins to load.

v0.9.0 - github.com/marzer/clang-tidier

Clang-tidy plugins

Clang tidy plugins can be specified in two ways:

  • directly using the argument --plugins (--load also works for compatibility with clang-tidy)
  • indirectly using either environment variables CLANG_TIDY_PLUGINS or CLANG_TIDIER_PLUGINS

Specifying multiple plugins via environment variable requires delimiting with semicolons. Regular unix-style colon delimiters are also supported on Unix.

Plugins specified on the command-line must exist; the program will exit with an error if they do not. Plugins specified via environment variable will be ignored with a warning if they are not found.

Exit codes

Value Meaning
0 No issues were found
1 Issues were found
-1 A fatal error occurred

Changelog

v0.10.0 - 2025/04/04

  • Added --external, --no-external

v0.9.1 - 2025/03/20

  • Fixed issues with plugin symlink resolution

v0.9.0 - 2025/03/19

  • Added support for reading plugins from environment
  • Added diagnostics if a specified plugin does not exist
  • Fixed plugin changes not trigging session restarts in some circumstances

v0.8.0 - 2025/03/16

  • Added --plugins

v0.7.2 - 2025/03/11

  • Fixed some additional compiler flag-related breakages

v0.7.1 - 2025/02/26

  • Fixed some additional compiler flag-related breakages

v0.7.0 - 2025/02/12

  • Added --fix
  • Fixed clang's -ftime-trace causing failures in some cases

v0.6.0 - 2025/02/10

  • Added --relative-paths to enable relative paths in output
  • Fixed paths in output always being relative by default

v0.5.2 - 2025/01/30

  • Fixed compiler argument slicing regression introduced in v0.5.1

v0.5.1 - 2025/01/29

  • Fixed sanitizer and GCC flags breaking clang-tidy in some common cases

v0.5.0 - 2025/01/27

  • Added --batch x/y to enable distributed parallelism
  • Minor internal fixes

v0.4.1 - 2024/11/19

  • Fixed precompiled headers breaking runs in some circumstances
  • Improved wording of session restart message

v0.4.0 - 2024/09/07

  • Fixed sessions not restarting if .clang-tidy is modified
  • Added --labels-only
  • Minor performance improvements

v0.3.0 - 2024/08/04

  • Added --no-session
  • Added use of sessions by default

v0.2.0 - 2024/08/03

  • Added --session

v0.1.2 - 2024/06/06

  • Fixed build-generated translation causing 'did not exist or was not a file' errors
  • Improved performance of TU enumeration step

v0.1.1 - 2024/05/16

  • Fixed issues with older clang-tidy versions trying to use --use-color

v0.1.0 - 2024/05/09

  • First public release 🎉️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clang_tidier-0.10.0.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clang_tidier-0.10.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file clang_tidier-0.10.0.tar.gz.

File metadata

  • Download URL: clang_tidier-0.10.0.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for clang_tidier-0.10.0.tar.gz
Algorithm Hash digest
SHA256 191ca2d4c83b52a09e7725416d7c796cee083cbdc00d764ebd3708b5369fb98e
MD5 8a0d94fce816fd316975162be6c2ee34
BLAKE2b-256 ecaaddcd9bf8fde2caaba53b9b1438c21f1f6dfcf630d88db3de21d8ba14a5cd

See more details on using hashes here.

File details

Details for the file clang_tidier-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: clang_tidier-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for clang_tidier-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 949c60eb84a67ac8fe6e7d7cf995787ea4e3a8aedbc0369d740eae5ccc8bf25b
MD5 38c2355a7722ff28d95ec0b75263a061
BLAKE2b-256 11a7bbf6a41320010b2d487ed064b841bc477d86f35ac29b094ccbc56a68b5dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page