Skip to content

Commit

Permalink
refactor fixes (#3923)
Browse files Browse the repository at this point in the history
* refactor fixes

* pre commit fixes

* cr fixes

* cr fixes
  • Loading branch information
YuvHayun committed Jan 3, 2024
1 parent 8c25dbd commit 5eca419
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions demisto_sdk/commands/content_graph/parsers/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ def __init__(self, path: Path, git_sha: Optional[str] = None) -> None:
self.relationships: Relationships = Relationships()
self.connect_pack_dependencies(metadata)
try:
self.contributors: List[str] = get_json(
path / PACK_CONTRIBUTORS_FILENAME, git_sha=git_sha
self.contributors: List[str] = (
get_json(path / PACK_CONTRIBUTORS_FILENAME, git_sha=git_sha) or []
)
except FileNotFoundError:
logger.debug(f"No contributors file found in {path}")
Expand Down
18 changes: 18 additions & 0 deletions demisto_sdk/commands/validate/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,10 @@ def get_files_from_git(self) -> Set[BaseContent]:
renamed_files,
deleted_files,
) = self.collect_files_to_run(self.file_path)
modified_files = self.filter_files(modified_files)
added_files = self.filter_files(added_files)
renamed_files = self.filter_files(renamed_files)
deleted_files = self.filter_files(deleted_files)
basecontent_with_path_set: Set[BaseContent] = set()
basecontent_with_path_set = basecontent_with_path_set.union(
self.paths_to_basecontent_set(
Expand Down Expand Up @@ -400,3 +404,17 @@ def paths_to_basecontent_set(
except InvalidContentItemException:
invalid_content_items.append(file_path)
return basecontent_with_path_set

def filter_files(self, files_set: Set[Path]):
"""Filter out all the files with suffixes that are not supported by BaseContent.
Args:
files_set (Set[Path]): The set of paths to filter
Returns:
Set: The set of filtered files.
"""
extensions_list_to_filter = [".png", ".md", ".svg"]
return set(
file for file in files_set if file.suffix not in extensions_list_to_filter
)

0 comments on commit 5eca419

Please sign in to comment.