Skip to content

Commit

Permalink
Merge pull request #295 from jxdv/update-type-check
Browse files Browse the repository at this point in the history
Update type check
  • Loading branch information
christophetd authored Jan 12, 2024
2 parents faf0947 + 34a248d commit c2c84e4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions guarddog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ def print_scan_results(results, identifier):
findings = results.get('results', [])
for finding in findings:
description = findings[finding]
if type(description) == str: # package metadata
if isinstance(description, str): # package metadata
print(colored(finding, None, attrs=['bold']) + ': ' + description)
print()
elif type(description) == list: # semgrep rule result:
elif isinstance(description, list): # semgrep rule result:
source_code_findings = description
print(colored(finding, None,
attrs=['bold']) + ': found ' + str(len(source_code_findings)) + ' source code matches')
Expand Down
2 changes: 1 addition & 1 deletion guarddog/reporters/sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def report_verify_sarif(package_path: str, rule_names: list[str], scan_results:
text = f"On package: {package} version: {version}\n" + "\n".join(map(
lambda x: x["message"],
scan_result_details[rule_name]
)) if type(scan_result_details[rule_name]) == list else scan_result_details[rule_name]
)) if isinstance(scan_result_details[rule_name], list) else scan_result_details[rule_name]
key = f"{rule_name}-{text}"
partial_fingerprints = {
f"guarddog/v1/{rule_name}": hashlib.sha256(key.encode('utf-8')).hexdigest()
Expand Down

0 comments on commit c2c84e4

Please sign in to comment.