Skip to content

Commit

Permalink
RuleSet: remove irrelevant rules after dependecies have been checked
Browse files Browse the repository at this point in the history
  • Loading branch information
yelhamer committed Jul 27, 2023
1 parent 97c878d commit 44c5e96
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions capa/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,11 +1218,6 @@ def __init__(
):
super().__init__()

if rules_filter_func:
# this allows for filtering the ruleset based on
# the execution context (static or dynamic)
rules = list(filter(rules_filter_func, rules))

ensure_rules_are_unique(rules)

# in the next step we extract subscope rules,
Expand All @@ -1237,6 +1232,11 @@ def __init__(

ensure_rule_dependencies_are_met(rules)

if rules_filter_func:
# this allows for filtering the ruleset based on
# the execution context (static or dynamic)
rules = list(filter(rules_filter_func, rules))

if len(rules) == 0:
raise InvalidRuleSet("no rules selected")

Expand Down

0 comments on commit 44c5e96

Please sign in to comment.