Skip to content

Commit bd30010

Browse files
authored
CM-13664 - do not scan cycode config file (#20)
* make exclude by path work for commit_history and repository scans * remove debug test * WIP * fix
1 parent 9360e13 commit bd30010

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

cli/code_scanner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from cli.config import configuration_manager
1919
from cli.utils.path_utils import is_sub_path, is_binary_file, get_file_size, get_relevant_files_in_path, get_path_by_os
2020
from cli.utils.string_utils import get_content_size, is_binary_content
21+
from cli.user_settings.config_file_manager import ConfigFileManager
2122
from cli.zip_file import InMemoryZip
2223
from cli.exceptions.custom_exceptions import CycodeError, HttpUnauthorizedError, ZipTooLargeError
2324
from cyclient import logger
@@ -398,7 +399,8 @@ def _does_document_exceed_max_size_limit(content: str) -> bool:
398399

399400
def _is_subpath_of_cycode_configuration_folder(filename: str) -> bool:
400401
return is_sub_path(configuration_manager.global_config_file_manager.get_config_directory_path(), filename) \
401-
or is_sub_path(configuration_manager.local_config_file_manager.get_config_directory_path(), filename)
402+
or is_sub_path(configuration_manager.local_config_file_manager.get_config_directory_path(), filename) \
403+
or filename.endswith(ConfigFileManager.get_config_file_route())
402404

403405

404406
def _handle_exception(context: click.Context, e: Exception):

cli/user_settings/config_file_manager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def get_config_directory_path(self) -> str:
6363
def get_filename(self) -> str:
6464
return os.path.join(self.get_config_directory_path(), self.FILE_NAME)
6565

66+
@staticmethod
67+
def get_config_file_route() -> str:
68+
return os.path.join(ConfigFileManager.CYCODE_HIDDEN_DIRECTORY, ConfigFileManager.FILE_NAME)
69+
6670
def _get_exclusions_by_exclusion_type(self, scan_type, exclusion_type) -> List:
6771
scan_type_exclusions = self.get_exclusions_by_scan_type(scan_type)
6872
return scan_type_exclusions.get(exclusion_type, [])

0 commit comments

Comments
 (0)