MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / scan_and_match

Method scan_and_match

tests/conftest.py:146–163  ·  view source on GitHub ↗
(self, input_file, matches, excludes=None, **kwargs)

Source from the content-addressed store, hash-verified

144 return visitor.tree["ast_tree"]
145
146 def scan_and_match(self, input_file, matches, excludes=None, **kwargs):
147 output = self.scan_test_file(input_file, **kwargs)
148
149 for x in matches:
150 try:
151 assert any(match_rule(h, x) for h in output["detections"]), (x, output["detections"])
152 except AssertionError:
153 for h in output["detections"]:
154 pprint.pprint(h)
155 raise
156
157 if excludes:
158 for x in excludes:
159 for hit in output["detections"]:
160 assert not match_rule(hit, x), hit
161
162 for hit in output["detections"]:
163 assert hit["type"] != "ASTParseError"
164
165
166def match_rule(source, target) -> bool:

Callers 15

test_cryptoFunction · 0.80
test_custom_analyzerFunction · 0.80
test_command_injectionFunction · 0.80
test_django_XSSFunction · 0.80
test_ensure_saved_scopeFunction · 0.80
test_list_appendFunction · 0.80
test_path_traversalFunction · 0.80

Calls 3

scan_test_fileMethod · 0.95
match_ruleFunction · 0.85
pprintMethod · 0.45

Tested by

no test coverage detected