Skip to content

Commit 98f84ec

Browse files
committed
Do not consider issue text in __eq__ method
Issue text is not supposed to be consistent between banndit versions. It was changed few times in the past. That's why we don't need to match text too between issues. This issue is only valid if we compare old bandit baseline generated with the old version with a new one generated using the last bandit.
1 parent 7a2ef1b commit 98f84ec

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

bandit/core/issue.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ def __str__(self):
3636
self.confidence, self.fname, self.lineno)
3737

3838
def __eq__(self, other):
39-
# if the issue text, severity, confidence, and filename match, it's
39+
# if the issue severity, confidence, and filename match, it's
4040
# the same issue from our perspective
41-
match_types = ['text', 'severity', 'confidence', 'fname', 'test',
42-
'test_id']
41+
match_types = ['severity', 'confidence', 'fname', 'test', 'test_id']
4342
return all(getattr(self, field) == getattr(other, field)
4443
for field in match_types)
4544

tests/unit/core/test_issue.py

-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ def test_matches_issue(self):
9393
# confidence doesn't match
9494
self.assertNotEqual(issue_a, issue_c)
9595

96-
# text doesn't match
97-
self.assertNotEqual(issue_a, issue_d)
98-
9996
# filename doesn't match
10097
self.assertNotEqual(issue_a, issue_e)
10198

0 commit comments

Comments
 (0)