From 280dc4a295dbf4a68441a3c510db2ff8951c4430 Mon Sep 17 00:00:00 2001 From: Labidurie Jerome Date: Fri, 17 May 2019 10:00:41 +0200 Subject: [PATCH] Fix Hitlist comparison by adding __eq__() & __ne__() to Hit class Signed-off-by: Labidurie Jerome --- flawfinder | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flawfinder b/flawfinder index 5cbfdfb..4f25b21 100755 --- a/flawfinder +++ b/flawfinder @@ -394,6 +394,16 @@ class Hit(object): def __getitem__(self, X): # Define this so this works: "%(line)" % hit 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 def cwes(self): result = find_cwe_pattern.search(self.warning)