Command Line Interface Options

-v, --verbosity

This controls the action’s verbosity in the workflow’s logs. Supported options are defined by the logging-level. This option does not affect the verbosity of resulting thread comments or file annotations.

Default:

"info"

-p, --database

The path that is used to read a compile command database. For example, it can be a CMake build directory in which a file named compile_commands.json exists (set CMAKE_EXPORT_COMPILE_COMMANDS to ON). When no build path is specified, a search for compile_commands.json will be attempted through all parent paths of the first input file. See https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an example of setting up Clang Tooling on a source tree.

-s, --style

The 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 using clang-format entirely.

Default:

"llvm"

-c, --tidy-checks

A comma-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 ('').

See also clang-tidy docs for more info.

Default:

"boost-*,bugprone-*,performance-*,readability-*,portability-*,modernize-*,clang-analyzer-*,cppcoreguidelines-*"

-V, --version

The desired version of the clang tools to use. Accepted options are strings which can be 8, 9, 10, 11, 12, 13, 14, 15, 16, 17.

  • 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). All paths specified here are converted to absolute.

Default:

""

-e, --extensions

A comma-separated list of file extensions to analyze.

Default:

"c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx"

-r, --repo-root

The relative path to the repository root directory. This path is relative to the runner’s GITHUB_WORKSPACE environment variable (or the current working directory if not using a CI runner).

Default:

"."

-i, --ignore

Set this option with path(s) to ignore (or not ignore).

  • In the case of multiple paths, you can use | to separate each path.

  • There is no need to use ./ for each entry; a blank string ('') represents the repo-root path.

  • This can also have files, but the file’s path (relative to the --repo-root) has to be specified with the filename.

  • Submodules are automatically ignored. Hidden directories (beginning with a .) are also ignored automatically.

  • Prefix a path with ! to explicitly not ignore it. This can be applied to a submodule’s path (if desired) but not hidden directories.

  • Glob patterns are not supported here. All asterisk characters (*) are literal.

Default:

".github|target"

-l, --lines-changed-only

This 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).

Default:

"true"

-f, --files-changed-only

Set this option to false to analyze any source files in the repo. This is automatically enabled if --lines-changed-only is enabled.

Note

The GITHUB_TOKEN should be supplied when running on a private repository with this option enabled, otherwise the runner does not not have the privilege to list the changed files for an event.

See Authenticating with the GITHUB_TOKEN

Default:

"false"

-x, --extra-arg

A string of extra arguments passed to clang-tidy for use as compiler arguments. This can be specified more than once for each additional argument. Recommend using quotes around the value and avoid using spaces between name and value (use = instead):

cpp-linter --extra-arg="-std=c++17" --extra-arg="-Wall"
-g, --thread-comments

Set this option to true to enable the use of thread comments as feedback. Set this to update to update an existing comment if one exists; the value ‘true’ will always delete an old comment and post a new one if necessary.

Note

To use thread comments, the GITHUB_TOKEN (provided by Github to each repository) must be declared as an environment variable.

See Authenticating with the GITHUB_TOKEN

Hint

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.

Default:

"false"

-t, --no-lgtm

Set this option to true or false to enable or disable the use of a thread comment that basically says ‘Looks Good To Me’ (when all checks pass).

See also

The --thread-comments option also notes further implications.

Default:

"true"

-w, --step-summary

Set this option to true or false to enable or disable the use of a workflow step summary when the run has concluded.

Default:

"false"

-a, --file-annotations

Set this option to false to disable the use of file annotations as feedback.

Default:

"true"