Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set complexity/_total to None in diff calculation #539

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

Swatinem
Copy link
Contributor

This was a recent regression from consolidating the diff calculation. Downstream code expects/asserts the complexity/_total to be None when no lines have been touched by the diff.

This was a recent regression from consolidating the diff calculation.
Downstream code expects/asserts the `complexity/_total` to be `None` when no lines have been touched by the diff.
@Swatinem Swatinem requested a review from a team February 26, 2025 11:53
@Swatinem Swatinem self-assigned this Feb 26, 2025
Copy link

codspeed-hq bot commented Feb 26, 2025

CodSpeed Performance Report

Merging #539 will create unknown performance changes

Comparing swatinem/fix-diffcomplexity (ff966ba) with main (f0be4d9)

Summary

⚠️ No benchmarks were detected in both the base of the PR and the PR.\

Copy link
Contributor

@joseph-sentry joseph-sentry left a comment

Choose a reason for hiding this comment

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

lgtm, just a request for clarification for the PR description

@@ -97,4 +98,9 @@ def calculate_report_diff(report: AbstractReport, diff: RawDiff) -> CalculatedDi

totals = sum_totals(list_of_file_totals)

if totals.lines == 0:
totals = dataclasses.replace(
Copy link
Contributor

Choose a reason for hiding this comment

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

if there's a reason we're using dataclasses.replace instead of in place modifying the attrs of totals can you mention it in the PR description

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven’t really thought about this. I just restored the code as it existed before my refactor, so there is no functional change.

@Swatinem Swatinem added this pull request to the merge queue Feb 26, 2025
Merged via the queue into main with commit ee38e96 Feb 26, 2025
8 checks passed
@Swatinem Swatinem deleted the swatinem/fix-diffcomplexity branch February 26, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants