aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorIvan Komissarov <abbapoh@gmail.com>2019-12-11 09:22:48 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2019-12-11 13:14:18 +0000
commit926968be010979aa3289c9418d4dd141f7b7e739 (patch)
treea4f82f93cef5d53e2238ee49ccbbf0c73bdc24d6 /scripts
parent761efa4df643571f564c59a303d99d0e7c434a97 (diff)
Remove duplicate files from compile_commands.json when running analyzer
It doesn't make sense to run clang-tidy on the same file multiple times (even though compile flags can be different) Change-Id: Ia6b26e0ec75e798fe10286ab637e039ed7774486 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/run-analyzer.sh12
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/run-analyzer.sh b/scripts/run-analyzer.sh
index 17ae2a8d7..c623aed1c 100755
--- a/scripts/run-analyzer.sh
+++ b/scripts/run-analyzer.sh
@@ -92,18 +92,22 @@ qbs generate -g clangdb -f "$QBS_SRC_DIR/qbs.qbs" $BUILD_OPTIONS
SCRIPT="
import json
import os
+import sets
import sys
-file = sys.argv[1]
+dbFile = sys.argv[1]
blacklist = ['json.cpp']
+seenFiles = sets.Set()
patched_db = []
-with open(file, 'r') as f:
+with open(dbFile, 'r') as f:
db = json.load(f)
for item in db:
- if os.path.basename(item['file']) not in blacklist:
+ file = item['file']
+ if (os.path.basename(file) not in blacklist) and (file not in seenFiles):
+ seenFiles.add(file)
patched_db.append(item)
-with open(file, 'w') as f:
+with open(dbFile, 'w') as f:
f.write(json.dumps(patched_db, indent=2))
"
python -c "${SCRIPT}" analyzer/compile_commands.json