fix linting issues

This commit is contained in:
Yacine Elhamer
2023-07-11 14:52:04 +01:00
parent 12c9154f55
commit 4ee38cbe29
4 changed files with 7 additions and 7 deletions

View File

@@ -204,8 +204,9 @@ SUPPORTED_FEATURES: Dict[str, Set] = {
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 @@ class Rule:
{
"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 @@ class 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]:

View File

@@ -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")

View File

@@ -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)