|
7 | 7 |
|
8 | 8 | from typing_extensions import Self, override |
9 | 9 |
|
10 | | -from codemodder.codetf import Finding, Rule |
11 | 10 | from codemodder.context import CodemodExecutionContext |
12 | 11 | from codemodder.logging import logger |
13 | 12 | from codemodder.result import LineInfo, Result, ResultSet, SarifLocation, SarifResult |
@@ -48,31 +47,11 @@ class SemgrepResult(SarifResult): |
48 | 47 | location_type = SemgrepLocation |
49 | 48 |
|
50 | 49 | @classmethod |
51 | | - def from_sarif( |
52 | | - cls, sarif_result, sarif_run, truncate_rule_id: bool = False |
53 | | - ) -> Self: |
54 | | - # avoid circular import |
| 50 | + def rule_url_from_id(cls, sarif_result, sarif_run, rule_id): |
| 51 | + del sarif_result, sarif_run |
55 | 52 | from core_codemods.semgrep.api import semgrep_url_from_id |
56 | 53 |
|
57 | | - return cls( |
58 | | - rule_id=( |
59 | | - rule_id := cls.extract_rule_id( |
60 | | - sarif_result, sarif_run, truncate_rule_id |
61 | | - ) |
62 | | - ), |
63 | | - locations=cls.extract_locations(sarif_result), |
64 | | - codeflows=cls.extract_code_flows(sarif_result), |
65 | | - related_locations=cls.extract_related_locations(sarif_result), |
66 | | - finding_id=rule_id, |
67 | | - finding=Finding( |
68 | | - id=rule_id, |
69 | | - rule=Rule( |
70 | | - id=rule_id, |
71 | | - name=rule_id, |
72 | | - url=semgrep_url_from_id(rule_id), |
73 | | - ), |
74 | | - ), |
75 | | - ) |
| 54 | + return semgrep_url_from_id(rule_id) |
76 | 55 |
|
77 | 56 |
|
78 | 57 | class SemgrepResultSet(ResultSet): |
|
0 commit comments