clang static analysis reports can be generated in html, plist, or sarif format.
This updates scan-build-py to be able to specify SARIF as the desired output format, as previously it only support plist and html formats.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Update to support running multiple TUs at once and merging the resulting sarif file into a single sarif file with multiple runs.
Support embedded links in results, codeflows, and threadflows. Does not support embedded links in other message properties (eg: location, since these generally do not refer to sarif runs indices)
Cleanup related to merge_sarif_files to be more readable, update the merge sarif test.
clang/tools/scan-build-py/libscanbuild/report.py | ||
---|---|---|
313 | arr not used? Change to: arr = [update_sarif_object(entry, runs_count_offset) for entry in sarif_object[key]] | |
337 | I think loop in a reverse order like makes more sense. | |
347 | pattern only used above, suggest move it up. | |
370 | Here you are assuming all the run index in one sarif file is sequential. (I believe this should be the case) |
clang/tools/scan-build-py/libscanbuild/report.py | ||
---|---|---|
370 | From my understanding, in a single sarif file, runs can point to any index in the set of contained runs. Ie we could have something like: sarif: { 'runs': [ { 'message': { 'text': 'this is a link to a future run [link](sarif:/runs/1/result/0)'}}, { 'message': { 'text': 'this is a link to another future run [link](sarif:/runs/2/result/0'}}, { 'message': { 'text': 'this is a link to the first run [link](sarif:/runs/0/result/0'}} ] } In this case, when merging this set of runs into another set of runs, embedded links would be updated to be relative to the "base" run index, such that and index of 0 becomes base_run_index, 1 becomes base_run_index+1, etc. I'm unsure of whether or not I can achieve this by iteratively increasing runs_count, since run indices are initially 0-indexed. From
|
clang/tools/scan-build-py/libscanbuild/report.py | ||
---|---|---|
370 | I see. |
arr not used?
Change to:
arr = [update_sarif_object(entry, runs_count_offset) for entry in sarif_object[key]]
sarif_object[key] = arr