Skip to content

feat: allow extra clang-tidy arguments #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ inputs:
description: 'List of checks'
default: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*'
required: false
extra_arguments:
description: 'Extra arguments to pass to the clang-tidy invocation'
default: ''
required: false
config_file:
description: 'Location of .clang-tidy config file. If specified, takes preference over `clang_tidy_checks`'
default: ''
Expand Down Expand Up @@ -87,6 +91,7 @@ runs:
- --build_dir=${{ inputs.build_dir }}
- --base_dir=${{ inputs.base_dir }}
- --clang_tidy_checks=${{ inputs.clang_tidy_checks }}
- --extra-arguments='${{ inputs.extra_arguments }}'
- --config_file=${{ inputs.config_file }}
- --include='${{ inputs.include }}'
- --exclude='${{ inputs.exclude }}'
Expand Down
2 changes: 2 additions & 0 deletions post/clang_tidy_review/clang_tidy_review/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,7 @@ def create_review(
max_task: int,
include: List[str],
exclude: List[str],
extra_arguments: list[str],
) -> Optional[PRReview]:
"""Given the parameters, runs clang-tidy and creates a review.
If no files were changed, or no warnings could be found, None will be returned.
Expand Down Expand Up @@ -987,6 +988,7 @@ def create_review(
"--enable-check-profile",
f"-store-check-profile={PROFILE_DIR}",
]
base_invocation += extra_arguments
if config:
print(f"Using config: {config}")
base_invocation.append(config)
Expand Down
7 changes: 7 additions & 0 deletions post/clang_tidy_review/clang_tidy_review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import argparse
import re
import shlex
import subprocess
from pathlib import Path

Expand Down Expand Up @@ -53,6 +54,11 @@ def main():
help="checks argument",
default="'-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*'",
)
parser.add_argument(
"--extra-arguments",
help="Extra arguments to pass to the clang-tidy invocation",
default="",
)
parser.add_argument(
"--config_file",
help="Path to .clang-tidy config file. If not empty, takes precedence over --clang_tidy_checks",
Expand Down Expand Up @@ -177,6 +183,7 @@ def main():
args.parallel,
include,
exclude,
shlex.split(args.extra_arguments),
)

with message_group("Saving metadata"):
Expand Down