diff --git a/run_community_analyzer.py b/run_community_analyzer.py index b6ab0acb..40ee6046 100644 --- a/run_community_analyzer.py +++ b/run_community_analyzer.py @@ -51,7 +51,7 @@ def get_files_to_analyze(code_path: str) -> set[str]: } -def main(argv: list[str] | None = None) -> None: +def main() -> None: """Runs the CLI.""" code_path = os.getenv("CODE_PATH", "/code") toolbox_path = os.getenv("TOOLBOX_PATH", "/toolbox") @@ -65,11 +65,12 @@ def main(argv: list[str] | None = None) -> None: help="Which community analyzer to run. Example: 'kube-linter'", required=False, ) - if argv: - args = parser.parse_args(argv, namespace=CommunityAnalyzerArgs) - # analyzer name is mandatory in case of community analyzers but not custom analyzers - if analyzer_name := args.analyzer: - issue_map_path = get_issue_map(analyzer_name) + args = parser.parse_args(argv, namespace=CommunityAnalyzerArgs) + + # analyzer name is mandatory in case of community analyzers but not custom analyzers + if analyzer_name := args.analyzer: + logger.info("Fetching issue map for: %s", analyzer_name) + issue_map_path = get_issue_map(analyzer_name) modified_files = get_files_to_analyze(code_path) run_sarif_parser( diff --git a/sarif-parser/src/sarif_parser/__init__.py b/sarif-parser/src/sarif_parser/__init__.py index 8f55099e..7e2bb16e 100644 --- a/sarif-parser/src/sarif_parser/__init__.py +++ b/sarif-parser/src/sarif_parser/__init__.py @@ -1,4 +1,5 @@ """sarif-parser - Parse SARIF reports and covert them to DeepSource issues.""" + from __future__ import annotations import hashlib @@ -57,6 +58,7 @@ def parse( deepsource_issues: list[Issue] = [] total_report_issues = 0 + issue_count_in_issues_map = 0 for run in sarif_data["runs"]: total_report_issues += len(run["results"]) for issue in run["results"]: @@ -121,9 +123,11 @@ def parse( logger.info( "Total issues in SARIF report: %s. \n" - "Issues extracted for the run in files sent for analysis: %s", + "Issues extracted for the run in files sent for analysis: %s. \n" + "Sanitized issues count with IDs in issue map: %s.", total_report_issues, len(deepsource_issues), + issue_count_in_issues_map, ) return deepsource_issues @@ -174,6 +178,9 @@ def run_sarif_parser( sentry.raise_info( f"Could not find issue map at {issue_map_path} for analyzer." ) + logger.warning( + "Could not find issue map at %s for analyzer.", issue_map_path + ) # Run parser deepsource_issues = []