Merge pull request #1317 from crytic/futureswap-ignore-markers

Handle ignore markers when exclude-dependencies is set
pull/1343/head
Feist Josselin 2 years ago committed by GitHub
commit a3bbd2e71e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      slither/core/slither_core.py

@ -48,7 +48,7 @@ class SlitherCore(Context):
self._previous_results_ids: Set[str] = set() self._previous_results_ids: Set[str] = set()
# Every slither object has a list of result from detector # Every slither object has a list of result from detector
# Because of the multiple compilation support, we might analyze # Because of the multiple compilation support, we might analyze
# Multiple time the same result, so we remove dupplicate # Multiple time the same result, so we remove duplicates
self._currently_seen_resuts: Set[str] = set() self._currently_seen_resuts: Set[str] = set()
self._paths_to_filter: Set[str] = set() self._paths_to_filter: Set[str] = set()
@ -209,7 +209,7 @@ class SlitherCore(Context):
- There is an ignore comment on the preceding line - There is an ignore comment on the preceding line
""" """
# Remove dupplicate due to the multiple compilation support # Remove duplicate due to the multiple compilation support
if r["id"] in self._currently_seen_resuts: if r["id"] in self._currently_seen_resuts:
return False return False
self._currently_seen_resuts.add(r["id"]) self._currently_seen_resuts.add(r["id"])
@ -245,6 +245,7 @@ class SlitherCore(Context):
if r["elements"] and matching: if r["elements"] and matching:
return False return False
if self._show_ignored_findings: if self._show_ignored_findings:
return True return True
if self.has_ignore_comment(r): if self.has_ignore_comment(r):
@ -252,9 +253,13 @@ class SlitherCore(Context):
if r["id"] in self._previous_results_ids: if r["id"] in self._previous_results_ids:
return False return False
if r["elements"] and self._exclude_dependencies: if r["elements"] and self._exclude_dependencies:
return not all(element["source_mapping"]["is_dependency"] for element in r["elements"]) if all(element["source_mapping"]["is_dependency"] for element in r["elements"]):
return False
# Conserve previous result filtering. This is conserved for compatibility, but is meant to be removed # Conserve previous result filtering. This is conserved for compatibility, but is meant to be removed
return not r["description"] in [pr["description"] for pr in self._previous_results] if r["description"] in [pr["description"] for pr in self._previous_results]:
return False
return True
def load_previous_results(self): def load_previous_results(self):
filename = self._previous_results_filename filename = self._previous_results_filename

Loading…
Cancel
Save