-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[report-converter] Support sarif format
Fixes #1797. Based on a commit authored by @csordasmarton. Credit goes to him! We've long wanted to support sarif (https://sarifweb.azurewebsites.net/), and finally, this is the first real step towards it! This patch can both parse and and export to sarif.
- Loading branch information
1 parent
c3dbb1b
commit e7aee25
Showing
8 changed files
with
450 additions
and
33 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
tools/report-converter/codechecker_report_converter/analyzers/gcc/sarif/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# ------------------------------------------------------------------------- | ||
# | ||
# Part of the CodeChecker project, under the Apache License v2.0 with | ||
# LLVM Exceptions. See LICENSE for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# ------------------------------------------------------------------------- |
36 changes: 36 additions & 0 deletions
36
tools/report-converter/codechecker_report_converter/analyzers/gcc/sarif/analyzer_result.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# ------------------------------------------------------------------------- | ||
# | ||
# Part of the CodeChecker project, under the Apache License v2.0 with | ||
# LLVM Exceptions. See LICENSE for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# ------------------------------------------------------------------------- | ||
|
||
import logging | ||
from typing import Dict, List | ||
|
||
from codechecker_report_converter.report import Report | ||
from codechecker_report_converter.report.parser import sarif | ||
|
||
from ..analyzer_result import AnalyzerResultBase | ||
|
||
|
||
LOG = logging.getLogger('report-converter') | ||
|
||
|
||
class AnalyzerResult(AnalyzerResultBase): | ||
""" Transform analyzer result of the FB Infer. """ | ||
|
||
TOOL_NAME = 'gcc' | ||
NAME = 'GNU Compiler Collection Static Analyzer' | ||
URL = 'https://gcc.gnu.org/wiki/StaticAnalyzer' | ||
|
||
def __init__(self): | ||
super(AnalyzerResult, self).__init__() | ||
self.__infer_out_parent_dir = None | ||
self._file_cache: Dict[str, File] = {} | ||
|
||
def get_reports(self, result_file_path: str) -> List[Report]: | ||
""" Get reports from the given analyzer result file. """ | ||
|
||
return sarif.Parser().get_reports(result_file_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.