Skip to content

Commit

Permalink
Change: dependency graph minor refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasHargarter committed Jan 24, 2025
1 parent 77ea91f commit 0fc9cae
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions troubadix/standalone_plugins/dependency_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
VTCategory,
)

EXTENSIONS = (".nasl",) # not sure if inc files can also have dependencies
DEPENDENCY_PATTERN = _get_special_script_tag_pattern(
"dependencies", flags=re.DOTALL | re.MULTILINE
)
Expand Down Expand Up @@ -145,13 +144,8 @@ def parse_args() -> Namespace:
return parser.parse_args()


# Usefull? Or is full only ever used and can therfore be removed?
def get_feed(root, feeds: list[Feed]) -> list[Script]:

def combine(x, y):
return x | y

feed = reduce(combine, feeds)
feed = reduce((lambda x, y: x | y), feeds)
scripts = []
if feed & Feed.COMMON:
scripts.extend(get_scripts(root / "common"))
Expand Down Expand Up @@ -179,7 +173,7 @@ def get_scripts(directory: Path) -> list[Script]:
feed = determine_feed(relative_path)
dependencies = extract_dependencies(content)
category = extract_category(content)
deprecated = extract_deprecated_status(content)
deprecated = bool(DEPRECATED_PATTERN.search(content))
scripts.append(
Script(name, feed, dependencies, category, deprecated)
)
Expand All @@ -197,10 +191,6 @@ def determine_feed(script_relative_path: Path) -> str:
return "community"


def extract_deprecated_status(content) -> bool:
return bool(DEPRECATED_PATTERN.search(content))


def split_dependencies(value: str) -> list[str]:
"""
removes blank lines, strips comments, cleans dependencies,
Expand Down

0 comments on commit 0fc9cae

Please sign in to comment.