Skip to content

Dedupe the --module override rewriting in pyrefly coverage#3851

Open
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/dedupe-module-override-rewrite
Open

Dedupe the --module override rewriting in pyrefly coverage#3851
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/dedupe-module-override-rewrite

Conversation

@jorenham

Copy link
Copy Markdown
Contributor

Summary

When --module is used with pyrefly coverage, the symbol prefixes are rewritten from the file-derived name to the override name. This rewriting logic was duplicated in collect_module_reports and the tests.

This resolves the code duplication by moving the rewriting logic to build_module_report itself. This also micro-dedupes the formatting code in the two for loops of the rewriting logic itself.

Test Plan

Tests still pass (refactor only; no behavior change)

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants