Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework exclude_paths logic #24

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sast_controller/bin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class Config(object):
"""Class with default configuration parameters"""
EXCLUDED_TYPES = ["png", "zip", "css", "txt", "svg", "mp3", "wav", "less", "gif"]
EXCLUDED_PATH = ["node_modules", "config", "coverage", "dist_", "test", "report", "i18n"]
EXCLUDED_PATH = ["node_modules", "config", "coverage", "dist_", "test", "report", "i18n", "tests"]
CODE_PATH = os.environ.get('CODE_PATH') or '/code'

CX_PROJECT_NAME = os.environ.get('CX_PROJECT', os.environ.get('PROJECT', None))
Expand Down
8 changes: 6 additions & 2 deletions sast_controller/drivers/cx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ def zinfo_from_file(fullname):

def is_not_excluded_path(path, exclude_paths):
"""Return False if path excluded, else True"""
split_path_list = []
for split_path in path.split("/"):
split_path_list.append(split_path)
if exclude_paths:
for exclude_path in exclude_paths:
if exclude_path.lower().strip() in path.lower():
return False
for split_path in split_path_list:
if exclude_path.lower().strip() == split_path.lower():
return False
return True


Expand Down