File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44from precli .core .level import Level
55from precli .core .location import Location
66from precli .core .rule import Rule
7+ from precli .core .suppression import Suppression
78
89
910class Result :
@@ -15,6 +16,7 @@ def __init__(
1516 location : Location = None ,
1617 message : str = None ,
1718 fixes : list [Fix ] = None ,
19+ suppressions : list [Suppression ] = None ,
1820 ):
1921 self ._rule_id = rule_id
2022 self ._kind = kind
@@ -30,6 +32,7 @@ def __init__(
3032 else :
3133 self ._message = Rule .get_by_id (self ._rule_id ).message
3234 self ._fixes = fixes if fixes is not None else []
35+ self ._suppressions = suppressions if suppressions is not None else []
3336
3437 @property
3538 def rule_id (self ) -> str :
@@ -111,3 +114,13 @@ def fixes(self) -> list[Fix]:
111114 :rtype: list
112115 """
113116 return self ._fixes
117+
118+ @property
119+ def suppressions (self ) -> list [Suppression ]:
120+ """
121+ Possible suppressions of the result.
122+
123+ :return: list of suppressions
124+ :rtype: list
125+ """
126+ return self ._suppressions
Original file line number Diff line number Diff line change 1+ # Copyright 2023 Secure Saurce LLC
2+ import enum
3+
4+
5+ class Status (str , enum .Enum ):
6+ """
7+ The status of a suppression.
8+
9+ :var ACCEPTED: The suppression is accepted.
10+ :vartype ACCEPTED: str
11+
12+ :var UNDER_REVIEW: Under review on whether to suppress it.
13+ :vartype UNDER_REVIEW: str
14+
15+ :var REJECTED: It was decided not to supporess the result.
16+ :vartype REJECTED: str
17+
18+ """
19+
20+ ACCEPTED = "accepted"
21+ UNDER_REVIEW = "underReview"
22+ REJECTED = "rejected"
Original file line number Diff line number Diff line change 1+ # Copyright 2023 Secure Saurce LLC
2+ from precli .core .location import Location
3+ from precli .core .status import Status
4+
5+
6+ class Suppression :
7+ def __init__ (
8+ self ,
9+ kind : str ,
10+ status : Status = None ,
11+ location : Location = None ,
12+ justification : str = None ,
13+ ):
14+ self ._kind = kind
15+ self ._status = status
16+ self ._location = location
17+ self ._justification = justification
18+
19+ @property
20+ def kind (self ) -> str :
21+ """
22+ The kind of suppression. This can be one of two values:
23+ "inSource" supporessed inline in the code
24+ "external" suppressed in an external persistent store
25+
26+ :return: kind of suppression
27+ :rtype: str
28+ """
29+ return "inSource"
30+
31+ @property
32+ def status (self ) -> Status :
33+ """
34+ The status of the suppression.
35+
36+ :return: status on whether to suppress
37+ :rtype: Status
38+ """
39+ return self ._status
40+
41+ @property
42+ def location (self ) -> Location :
43+ """
44+ Specifies the location of the suppression.
45+
46+ :return: location of suppression
47+ :rtype: Location
48+ """
49+ return self ._location
50+
51+ def justification (self ) -> str :
52+ """
53+ User-supplied string that explains why the result was suppressed.
54+
55+ :return: why the result was suppressed
56+ :rtype: str
57+ """
58+ return self ._justification
You can’t perform that action at this time.
0 commit comments