--- /dev/null
+#!/usr/bin/env python3
+
+"""Filter git diff files that are not in the product.
+
+Filter files out of a git diff output that are not part of the product found in
+the current directory.
+
+"""
+
+import os
+import sys
+
+import helpers
+import unidiff
+
+
+def main():
+ """Start the script."""
+ compdb = helpers.load_compdb("compile_commands.json")
+ compdb = helpers.index_compdb(compdb)
+
+ root = helpers.get_repo_root()
+
+ diff = sys.stdin.read()
+ patch_set = unidiff.PatchSet(diff)
+ for patch in patch_set:
+ path = os.path.join(root, patch.path)
+ if path in compdb:
+ print(patch)
+
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
- run: ln -s .clang-tidy.full .clang-tidy
- name: Run clang-tidy
working-directory: pdns
- run: git diff -U0 HEAD^..HEAD | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p2 -export-fixes clang-tidy-auth.yml
+ run: git diff -U0 HEAD^..HEAD | python3 ../.github/scripts/git-filter.py | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p2 -export-fixes clang-tidy-auth.yml
- name: Print clang-tidy fixes YAML
working-directory: pdns
shell: bash
- run: inv ci-rec-make-bear
- run: ln -s ../../.clang-tidy.full .clang-tidy
- name: Run clang-tidy
- run: git diff -U0 HEAD^..HEAD | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p3 -export-fixes clang-tidy-rec.yml
+ run: git diff -U0 HEAD^..HEAD | python3 ../../.github/scripts/git-filter.py | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p3 -export-fixes clang-tidy-rec.yml
- name: Print clang-tidy fixes YAML
shell: bash
run: |
- run: inv ci-dnsdist-make-bear
- run: ln -s ../../.clang-tidy.full .clang-tidy
- name: Run clang-tidy
- run: git diff -U0 HEAD^..HEAD | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p3 -export-fixes clang-tidy-dnsdist.yml
+ run: git diff -U0 HEAD^..HEAD | python3 ../../.github/scripts/git-filter.py | python3 /usr/bin/clang-tidy-diff-12.py -clang-tidy-binary /usr/bin/clang-tidy-12 -extra-arg=-ferror-limit=0 -p3 -export-fixes clang-tidy-dnsdist.yml
- name: Print clang-tidy fixes YAML
shell: bash
run: |