cpp-linter/C/C++ Linter

Linting C/C++ code with clang-tidy or clang-format to give feedback as comments, PR reviews, and more.

View on GitHub

Trust Signals

Scorecard Score
not yet scored
Maintenance Recency
Activelast commit Jul 4, 2026
License
MIT

Pinned Snippet

workflow.ymlSHA-pinned
uses: cpp-linter/cpp-linter-action@8e85cd02c8c3fe3ae527c94b5683fe2366b144ed # v2.20.0

tags can be moved; commit SHAs can't. why a SHA?

namedescriptionrequireddefault
styleThe style rules to use. - Set this to `file` to have clang-format use the closest relative .clang-format file. - Set this to a blank string (`''`) to disable the use of clang-format entirely. - Any code style supported by the specified version of clang-format. nollvm
extensionsThe file extensions to run the action against. This is a comma-separated string.noc,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx
tidy-checksComma-separated list of globs with optional `-` prefix. Globs are processed in order of appearance in the list. Globs without `-` prefix add checks with matching names to the set, globs with the `-` prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in a .clang-tidy file (if any). - It is possible to disable clang-tidy entirely by setting this option to `'-*'`. - It is also possible to rely solely on a .clang-tidy config file by specifying this option as a blank string (`''`). noboost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*
repo-rootThe relative path to the repository root directory. This path is relative to the path designated as the runner's `GITHUB_WORKSPACE` environment variable. no.
versionThe desired version of the [clang-tools](https://github.com/cpp-linter/clang-tools-pip) to use. Accepted options are strings which can be 22, 21, 20, 19, 18, 17, 16, 15, 14, 13 or 12. - Set this option to a blank string (`''`) to use the platform's default installed version. - This value can also be a path to where the clang tools are installed (if using a custom install location). no21
verbosityThis controls the action's verbosity in the workflow's logs. Supported options are `info` or `debug`. This option does not affect the verbosity of resulting thread comments or file annotations. The verbosity can also be engaged by enabling debug logs when [re-running jobs or workflows](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs). noinfo
lines-changed-onlyThis controls what part of the files are analyzed. The following values are accepted: - `false`: All lines in a file are analyzed. - `true`: Only lines in the diff that contain additions are analyzed. - `diff`: All lines in the diff are analyzed (including unchanged lines but not subtractions). !!! info "Important" This feature requires special permissions to perform successfully. See our [documented permissions](permissions.md) nofalse
files-changed-onlySet this option to false to analyze any source files in the repo. This is automatically enabled if [`lines-changed-only`](#lines-changed-only) is enabled. !!! info "Important" This feature requires special permissions to perform successfully. See our [documented permissions](permissions.md) notrue
ignoreSet this option with string of path(s) to ignore. - In the case of multiple paths, you can use a pipe character (`|`) to separate the multiple paths. Multiple lines are forbidden as an input to this option; it must be a single string. - This can also have files, but the file's relative path has to be specified as well. - There is no need to use `./` for each entry; a blank string (`''`) represents the [`repo-root`](#repo-root) path. - Submodules are automatically ignored. Hidden directories (beginning with a `.`) are also ignored automatically. - Prefix a path with a bang (`!`) to make it explicitly _not_ ignored. The order of multiple paths does _not_ take precedence. The `!` prefix can be applied to a submodule's path (if desired) but not hidden directories. - **As of v2.12**, glob patterns are supported here. All asterisk characters (`*`) were previously literal. no.github
ignore-tidyUse this option to allow clang-tidy to ignore certain paths/files. See [`ignore`](#ignore) for more details on possible values.no.github
ignore-formatUse this option to allow clang-format to ignore certain paths/files. See [`ignore`](#ignore) for more details on possible values.no.github
thread-commentsThis controls the behavior of posted thread comments as feedback. The following options are supported: - `true`: enable the use of thread comments. This will always delete an outdated thread comment and post a new comment (triggering a notification for every comment). - `update`: update an existing thread comment if one already exists. This option does not trigger a new notification for every thread comment update. - `false`: disable the use of thread comments. !!! info "Important" This feature requires special permissions to perform successfully. See our [documented permissions](permissions.md) > [!NOTE] > If run on a private repository, then this feature is disabled because the GitHub REST API behaves differently for thread comments on a private repository. nofalse
no-lgtmSet this option to true or false to enable or disable the use of a thread comment or pull request review that basically says 'Looks Good To Me' (when all checks pass). The default value, `true` means no LGTM comment posted. See [`thread-comments`](#thread-comments), [`tidy-review`](#tidy-review), and [`format-review`](#format-review) options for further details. notrue
step-summarySet this option to true to append content as part of workflow's job summary. See implementation details in GitHub's documentation about [Adding a job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary). This option is independent of the [`thread-comments`](#thread-comments) option, rather this option uses the same content that the [`thread-comments`](#thread-comments) option would use. > [!NOTE] > The [`no-lgtm`](#no-lgtm) option is _not_ applied to step summaries. nofalse
file-annotationsSet this option to false to disable the use of file annotations as feedback. notrue
databaseThe directory containing compilation database (like compile_commands.json) file.no""
extra-argsA string of extra arguments passed to clang-tidy for use as compiler arguments. Multiple arguments are separated by spaces so the argument name and value should use an `=` sign instead of a space. !!! example ``` yaml extra-args: '-std=c++17 -Wall' ``` This will be passed to clang-tidy as multiple `--extra-arg` options: ``` clang-tidy --extra-arg=-std=c++17 --extra-arg=-Wall ``` no""
tidy-reviewSet this option to `true` to enable Pull Request reviews from clang-tidy. !!! info "Important" This feature requires special permissions to perform successfully. See our [documented permissions](permissions.md). See also [the PR review feature caveats](pr-review-caveats.md). > [!NOTE] > The [`no-lgtm`](#no-lgtm) option is applicable to Pull Request reviews. nofalse
format-reviewSet this option to `true` to enable Pull Request reviews from clang-format. !!! info "Important" This feature requires special permissions to perform successfully. See our [documented permissions](permissions.md). See also [the PR review feature caveats](pr-review-caveats.md). > [!NOTE] > The [`no-lgtm`](#no-lgtm) option is applicable to Pull Request reviews. nofalse
passive-reviewsSet this option to `true` to prevent Pull Request reviews from approving or requesting changes. nofalse
jobsThe number of jobs to run in parallel. If less than or equal to 0, the number of jobs is set to use the number of all available CPU cores. no0
cache-enableControls the caching of cpp-linter dependencies. The installed `clang-format` and `clang-tidy` tools are not cached. By default, this is enabled. Any cached assets are kept within the path to this action's source (not in the runner's workspace or temp directory).notrue
summary-output-fileSupply a path to which the step summary will be written. Leave empty to not write summary to a file. > [!NOTE] > Any relative path shall be relative to the [`repo-root`](#repo-root) path.no""
namedescription
checks-failedAn integer that can be used as a boolean value to indicate if any checks failed by clang-tidy and clang-format.
clang-tidy-checks-failedAn integer that can be used as a boolean value to indicate if any checks failed by clang-tidy only.
clang-format-checks-failedAn integer that can be used as a boolean value to indicate if any checks failed by clang-format only.