Skip to content
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

exclude generated files from clang-tidy. #23

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
- id: Clang-Tidy
name: Clang-Tidy
run: |
python tools/bin/run-clang-tidy.py -quiet -export-fixes=build/clang-tidy-fix.yaml -p build -extra-arg=-Wno-unknown-warning-option -header-filter=$(pwd)'/(include|src|examples)/.*\.h$' $(pwd)'/(src|examples)/.*' 2>&1 | awk '!a[$0]++{print > "build/clang-tidy.log"}'
python tools/bin/run-clang-tidy.py -quiet -export-fixes=build/clang-tidy-fix.yaml -p build -extra-arg=-Wno-unknown-warning-option -header-filter=$(pwd)'/(include|src|examples)/.*\.h$' -exclude='sql_(parser|scanner)\.cpp$' $(pwd)'/(src|examples)/.*' 2>&1 | awk '!a[$0]++{print > "build/clang-tidy.log"}'
if: matrix.container-tag == 'ubuntu-22.04'

- id: Doxygen
Expand Down
10 changes: 9 additions & 1 deletion tools/bin/run-clang-tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ def main():
'command line.')
parser.add_argument('-quiet', action='store_true',
help='Run clang-tidy in quiet mode')
parser.add_argument('-exclude',
action='append', default=[],
help='excluding target files (regex on path)')
args = parser.parse_args()

db_path = 'compile_commands.json'
Expand Down Expand Up @@ -261,6 +264,11 @@ def main():
# Build up a big regexy filter from all command line arguments.
file_name_re = re.compile('|'.join(args.files))

if args.exclude:
exclude_name_re = re.compile('|'.join(args.exclude))
else:
exclude_name_re = re.compile('^$') # never much to any paths

return_code = 0
try:
# Spin up a bunch of tidy-launching threads.
Expand All @@ -276,7 +284,7 @@ def main():

# Fill the queue with files.
for name in files:
if file_name_re.search(name):
if file_name_re.search(name) and not exclude_name_re.search(name):
task_queue.put(name)

# Wait for all threads to be done.
Expand Down