Skip to content

Add [coverage] config overrides for the pyrefly coverage globs#4146

Open
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/config
Open

Add [coverage] config overrides for the pyrefly coverage globs#4146
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/config

Conversation

@jorenham

Copy link
Copy Markdown
Contributor

Summary

pyrefly coverage {check, report} used the same project-{includes,excludes} as pyrefly check, so measuring coverage on a different file set (e.g. skipping tests, vendored code, or publically-namespaced private API) required repeatedly specifiying --project-excludes for every pyrefly coverage call.

This adds an optional [coverage] config table with includes and excludes that override the project globs when using pyrefly coverage (and only then).
Each field defaults to its top-level project- counterpart when unset (like it does now).
The --project-excludes flag takes precedence over coverage.excludes, and positional FILES... args also do (just like with the project- globs).
Unknown keys inside [coverage] are reported in a warning message in the same way as with the other config tables.

Test Plan

Config tests added for parsing, path rewriting, and glob resolution (for both the "default" and "coverage" config scopes), and verified that a [coverage] config indeed narrows pyrefly coverage report without affecting pyrefly check and explicit FILES... ("file mode" I believe it's called).

@jorenham

Copy link
Copy Markdown
Contributor Author

cc @MarcoGorelli

@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.

1 participant