mirror of
https://github.com/mandiant/capa.git
synced 2025-12-21 23:00:29 -08:00
lint.py: fix boolean statement
This commit is contained in:
@@ -166,7 +166,7 @@ class MissingStaticScope(Lint):
|
|||||||
recommendation = "Add a static scope for the rule (file, function, basic block, instruction, or unspecified)"
|
recommendation = "Add a static scope for the rule (file, function, basic block, instruction, or unspecified)"
|
||||||
|
|
||||||
def check_rule(self, ctx: Context, rule: Rule):
|
def check_rule(self, ctx: Context, rule: Rule):
|
||||||
return "static" in rule.meta.get("scopes")
|
return "static" not in rule.meta.get("scopes")
|
||||||
|
|
||||||
|
|
||||||
class MissingDynamicScope(Lint):
|
class MissingDynamicScope(Lint):
|
||||||
@@ -174,7 +174,7 @@ class MissingDynamicScope(Lint):
|
|||||||
recommendation = "Add a dynamic scope for the rule (file, process, thread, call, or unspecified)"
|
recommendation = "Add a dynamic scope for the rule (file, process, thread, call, or unspecified)"
|
||||||
|
|
||||||
def check_rule(self, ctx: Context, rule: Rule):
|
def check_rule(self, ctx: Context, rule: Rule):
|
||||||
return "dynamic" in rule.meta.get("scopes")
|
return "dynamic" not in rule.meta.get("scopes")
|
||||||
|
|
||||||
|
|
||||||
class InvalidStaticScope(Lint):
|
class InvalidStaticScope(Lint):
|
||||||
@@ -214,8 +214,8 @@ class InvalidScopes(Lint):
|
|||||||
recommendation = "At least one scope (static or dynamic) must be specified"
|
recommendation = "At least one scope (static or dynamic) must be specified"
|
||||||
|
|
||||||
def check_rule(self, ctx: Context, rule: Rule):
|
def check_rule(self, ctx: Context, rule: Rule):
|
||||||
return (rule.meta.get("scope").get("static") not in ("unspecified", "unsupported")) or (
|
return (rule.meta.get("scope").get("static") in ("unspecified", "unsupported")) and (
|
||||||
rule.meta.get("scope").get("dynamic") not in ("unspecified", "unsupported")
|
rule.meta.get("scope").get("dynamic") in ("unspecified", "unsupported")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user