Skip to content

Commit

Permalink
False Pos path excl: Add comment processing
Browse files Browse the repository at this point in the history
This allows comments in the path exlusion regex file. Instead of
adding each line as a filtering rule, it skips empty lines and
lines starting with a # symbol.

Fixes https://issues.redhat.com/browse/OSH-508
  • Loading branch information
stefan-cornelius committed Jan 26, 2024
1 parent da45ba3 commit 4fed291
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions py/common/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,5 +404,8 @@ def handle_known_fp_list(props, results):
lines = file_handle.readlines()
for line in lines:
path_re = line.strip()
if len(path_re) == 0 or path_re.startswith("#"):
# skip comments and empty lines
continue
filter_cmd = f'csgrep --mode=json --invert-match --path="{shell_quote(path_re)}"'
props.result_filters += [filter_cmd]

0 comments on commit 4fed291

Please sign in to comment.