Skip to content

Commit 4245542

Browse files
committed
simplify fix
1 parent 4634765 commit 4245542

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

cycode/cli/commands/scan/code_scanner.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def create_local_scan_result(
455455
documents_to_scan: List[Document],
456456
command_scan_type: str,
457457
scan_type: str,
458-
severity_threshold: Optional[str],
458+
severity_threshold: str,
459459
) -> LocalScanResult:
460460
document_detections = get_document_detections(scan_result, documents_to_scan)
461461
relevant_document_detections_list = exclude_irrelevant_document_detections(
@@ -630,7 +630,7 @@ def exclude_irrelevant_document_detections(
630630
document_detections_list: List[DocumentDetections],
631631
scan_type: str,
632632
command_scan_type: str,
633-
severity_threshold: Optional[str],
633+
severity_threshold: str,
634634
) -> List[DocumentDetections]:
635635
relevant_document_detections_list = []
636636
for document_detections in document_detections_list:
@@ -712,15 +712,11 @@ def try_get_git_remote_url(path: str) -> Optional[str]:
712712

713713

714714
def exclude_irrelevant_detections(
715-
detections: List[Detection], scan_type: str, command_scan_type: str, severity_threshold: Optional[str]
715+
detections: List[Detection], scan_type: str, command_scan_type: str, severity_threshold: str
716716
) -> List[Detection]:
717717
relevant_detections = _exclude_detections_by_exclusions_configuration(detections, scan_type)
718718
relevant_detections = _exclude_detections_by_scan_type(relevant_detections, scan_type, command_scan_type)
719-
720-
if severity_threshold:
721-
return _exclude_detections_by_severity(relevant_detections, severity_threshold)
722-
723-
return relevant_detections
719+
return _exclude_detections_by_severity(relevant_detections, severity_threshold)
724720

725721

726722
def _exclude_detections_by_severity(detections: List[Detection], severity_threshold: str) -> List[Detection]:

cycode/cli/commands/scan/scan_command.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import List, Optional
2+
from typing import List
33

44
import click
55

@@ -65,7 +65,7 @@
6565
)
6666
@click.option(
6767
'--severity-threshold',
68-
default=None,
68+
default=Severity.INFO.name,
6969
help='Show violations only for the specified level or higher.',
7070
type=click.Choice([e.name for e in Severity]),
7171
required=False,
@@ -117,7 +117,7 @@ def scan_command(
117117
client_id: str,
118118
show_secret: bool,
119119
soft_fail: bool,
120-
severity_threshold: Optional[str],
120+
severity_threshold: str,
121121
sca_scan: List[str],
122122
monitor: bool,
123123
report: bool,

0 commit comments

Comments
 (0)