Fix Hitlist comparison by adding __eq__() & __ne__() to Hit class
Signed-off-by: Labidurie Jerome <jerome.labidurie@orange.com>
This commit is contained in:
parent
1e2e6f590f
commit
280dc4a295
10
flawfinder
10
flawfinder
|
@ -394,6 +394,16 @@ class Hit(object):
|
||||||
def __getitem__(self, X): # Define this so this works: "%(line)" % hit
|
def __getitem__(self, X): # Define this so this works: "%(line)" % hit
|
||||||
return getattr(self, X)
|
return getattr(self, X)
|
||||||
|
|
||||||
|
def __eq__(self, other):
|
||||||
|
return (self.filename == other.filename
|
||||||
|
and self.line == other.line
|
||||||
|
and self.column == other.column
|
||||||
|
and self.level == other.level
|
||||||
|
and self.name == other.name)
|
||||||
|
|
||||||
|
def __ne__(self, other):
|
||||||
|
return not self == other
|
||||||
|
|
||||||
# return CWEs
|
# return CWEs
|
||||||
def cwes(self):
|
def cwes(self):
|
||||||
result = find_cwe_pattern.search(self.warning)
|
result = find_cwe_pattern.search(self.warning)
|
||||||
|
|
Loading…
Reference in New Issue