Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion integration_tests/test_codemod_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ async def visit_url(client, url):
return url, None


@pytest.mark.asyncio
async def check_accessible_urls(urls):
async with httpx.AsyncClient() as client:
tasks = [visit_url(client, url) for url in urls]
Expand All @@ -36,6 +35,7 @@ async def check_accessible_urls(urls):


@pytest.mark.asyncio
@pytest.mark.skip(reason="Flaky test, needs investigation")
async def test_codemod_reference_urls():
urls = list(
set(
Expand All @@ -50,6 +50,7 @@ async def test_codemod_reference_urls():


@pytest.mark.asyncio
@pytest.mark.skip(reason="Flaky test, needs investigation")
async def test_tool_rules_urls():
urls = [
rule.url
Expand Down
7 changes: 3 additions & 4 deletions src/codemodder/codetf/v3/codetf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ..common import Change, CodeTFWriter, Finding, FixQuality
from ..v2.codetf import AIMetadata as AIMetadatav2
from ..v2.codetf import CodeTF as CodeTFv2
from ..v2.codetf import Finding as V2Finding
from ..v2.codetf import Result
from ..v2.codetf import Run as Runv2

Expand Down Expand Up @@ -99,7 +98,7 @@ class FixMetadata(BaseModel):
class FixResult(BaseModel):
"""Result corresponding to a single finding"""

finding: Finding | V2Finding
finding: Finding
fixStatus: FixStatus
changeSets: list[ChangeSet] = []
fixMetadata: Optional[FixMetadata] = None
Expand Down Expand Up @@ -174,7 +173,7 @@ def from_v2_result(result: Result) -> list[FixResult]:
)
fix_results.append(
FixResult(
finding=f,
finding=Finding(**f.model_dump()),
fixStatus=FixStatus(status=FixStatusType.fixed),
changeSets=[changeset],
fixMetadata=fix_metadata,
Expand All @@ -185,7 +184,7 @@ def from_v2_result(result: Result) -> list[FixResult]:
for f in result.unfixedFindings or []:
fix_results.append(
FixResult(
finding=f,
finding=Finding(**f.model_dump()),
fixStatus=FixStatus(status=FixStatusType.failed, reason=f.reason),
)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_codetf.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ def test_v2_to_v3_conversion():
# correctly associates findings to the change
assert f.changeSets and f.changeSets[0].path == v2changeset.path
assert f.changeSets and f.changeSets[0].diff == v2changeset.diff
assert isinstance(f.finding, Finding) and f.changeSets[0].changes == [
v2_finding_to_change[f.finding].to_common()
assert isinstance(f.finding, FindingV3) and f.changeSets[0].changes == [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is FindingV3?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just an alias for the CodeTFv3 version of Finding

v2_finding_to_change[Finding(**f.finding.model_dump())].to_common()
]

# unfixed metadata
assert (
unfixed[0].fixStatus.reason
and unfixed[0].fixStatus.reason == v2_unfixed[0].reason
)
assert unfixed[0].finding == v2_unfixed[0]
assert unfixed[0].finding == FindingV3(**v2_unfixed[0].model_dump())
Loading