Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yelhamer committed Jul 11, 2023
1 parent 12c9154 commit 4ee38cb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
7 changes: 4 additions & 3 deletions capa/rules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions scripts/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion tests/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4ee38cb

Please sign in to comment.