mirror of
https://github.com/mandiant/capa.git
synced 2025-12-27 21:23:12 -08:00
account for Windows paths
This commit is contained in:
@@ -89,7 +89,7 @@ class NamespaceDoesntMatchRulePath(Lint):
|
||||
if "lib" in rule.meta:
|
||||
return False
|
||||
|
||||
return rule.meta["namespace"] not in posixpath.normpath(rule.meta["capa/path"])
|
||||
return rule.meta["namespace"] not in get_normpath(rule.meta["capa/path"])
|
||||
|
||||
|
||||
class MissingScope(Lint):
|
||||
@@ -216,7 +216,7 @@ class LibRuleNotInLibDirectory(Lint):
|
||||
if "lib" not in rule.meta:
|
||||
return False
|
||||
|
||||
return "/lib/" not in posixpath.normpath(rule.meta["capa/path"])
|
||||
return "/lib/" not in get_normpath(rule.meta["capa/path"])
|
||||
|
||||
|
||||
class LibRuleHasNamespace(Lint):
|
||||
@@ -314,6 +314,10 @@ FEATURE_LINTS = (
|
||||
)
|
||||
|
||||
|
||||
def get_normpath(path):
|
||||
return posixpath.normpath(path).replace(os.sep, "/")
|
||||
|
||||
|
||||
def lint_features(ctx, rule):
|
||||
features = get_features(ctx, rule)
|
||||
return run_feature_lints(FEATURE_LINTS, ctx, features)
|
||||
|
||||
Reference in New Issue
Block a user