MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / filtered

Method filtered

aura/output/base.py:133–165  ·  view source on GitHub ↗

Helper function get a list of filtered results regardless of the output type This list of results should then be serialized by a specific output format :param hits: input hits/results that will be filtered :return: a list of filtered results

(self, hits)

Source from the content-addressed store, hash-verified

131 ...
132
133 def filtered(self, hits):
134 """
135 Helper function get a list of filtered results regardless of the output type
136 This list of results should then be serialized by a specific output format
137
138 :param hits: input hits/results that will be filtered
139 :return: a list of filtered results
140 """
141 hits = sorted(hits)
142
143 processed = []
144
145 for x in hits:
146 # normalize tags
147 tags = [t.lower().replace('-', '_') for t in x.tags]
148
149 # if verbosity is below 2, informational results are filtered
150 # norm is that informational results should have a score of 0
151 if self.verbosity < 2 and x.informational and x.score == 0:
152 continue
153 elif not all(f(tags) for f in self.tag_filters):
154 continue
155 elif self.verbosity < 3 and x.name == "ASTParseError" and x._metadata.get("source") == "blob":
156 continue
157 else:
158 processed.append(x)
159
160 total_score = sum(x.score for x in processed)
161
162 if self.min_score and self.min_score > total_score:
163 raise exceptions.MinimumScoreNotReached(f"Score of {total_score} did not meet the minimum {self.min_score}")
164
165 return processed
166
167
168@dataclass()

Callers 4

scan_uriFunction · 0.45
output_diffMethod · 0.45
output_diffMethod · 0.45
output_diffMethod · 0.45

Calls 1

getMethod · 0.80

Tested by

no test coverage detected