diff --git a/capa/rules/__init__.py b/capa/rules/__init__.py index ee5a9c49e..2f0137f53 100644 --- a/capa/rules/__init__.py +++ b/capa/rules/__init__.py @@ -204,8 +204,9 @@ def from_dict(self, scopes: dict) -> "Scopes": capa.features.common.Namespace, }, DEV_SCOPE: { - # TODO: this is a temporary scope. remove it after support + # TODO(yelhamer): this is a temporary scope. remove it after support # for the legacy scope keyword has been added (to rendering). + # https://github.com/mandiant/capa/pull/1580 capa.features.insn.API, }, } @@ -777,7 +778,6 @@ def _extract_subscope_rules_rec(self, statement): { "name": name, "scopes": asdict(Scopes(subscope.scope, DEV_SCOPE)), - "" # these derived rules are never meant to be inspected separately, # they are dependencies for the parent rule, # so mark it as such. @@ -864,6 +864,7 @@ def from_dict(cls, d: Dict[str, Any], definition: str) -> "Rule": # we should go back and update this accordingly to either: # - generate one englobing statement. # - generate two respective statements and store them approriately + # https://github.com/mandiant/capa/pull/1580 statement = build_statements(statements[0], scopes.static) _ = build_statements(statements[0], scopes.dynamic) return cls(name, scopes, statement, meta, definition) @@ -1047,7 +1048,7 @@ def get_rules_with_scope(rules, scope) -> List[Rule]: from the given collection of rules, select those with the given scope. `scope` is one of the capa.rules.*_SCOPE constants. """ - return list(rule for rule in rules if scope in rule.scopes) + return [rule for rule in rules if scope in rule.scopes] def get_rules_and_dependencies(rules: List[Rule], rule_name: str) -> Iterator[Rule]: diff --git a/scripts/lint.py b/scripts/lint.py index 632bcda96..ae3f06aa4 100644 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -928,8 +928,8 @@ def main(argv=None): if argv is None: argv = sys.argv[1:] - # TODO(yelhamer): remove once support for the legacy scope - # field has been added + # TODO(yelhamer): remove once support for the legacy scope field has been added + # https://github.com/mandiant/capa/pull/1580 return 0 samples_path = os.path.join(os.path.dirname(__file__), "..", "tests", "data") diff --git a/tests/data b/tests/data index 3a0081ac6..f4e21c603 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 3a0081ac6bcf2259d27754c1320478e75a5daeb0 +Subproject commit f4e21c6037e40607f14d521af370f4eedc2c5eb9 diff --git a/tests/test_rules.py b/tests/test_rules.py index 038dec359..f15a0bb71 100644 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -127,7 +127,6 @@ def test_rule_descriptions(): def rec(statement): if isinstance(statement, capa.engine.Statement): - print(statement.description) assert statement.description == statement.name.lower() + " description" for child in statement.get_children(): rec(child)