Skip to content

Change coverage percentage calculation for zero cases#1

Open
shannon wants to merge 2 commits intohiddentao:mainfrom
shannon:patch-1
Open

Change coverage percentage calculation for zero cases#1
shannon wants to merge 2 commits intohiddentao:mainfrom
shannon:patch-1

Conversation

@shannon
Copy link
Copy Markdown

@shannon shannon commented Dec 12, 2025

Sometimes I may have a module that does not contain any functions. A constants file, or a module that re-exports other modules, or simply a file that only has top level logic. When this happens the functions is 0/0 but the percentage covered is 0%. I think it may make more sense to set the percentage to 100% when the total is 0.

I changed all of them just to keep it consistent but I can't imagine a scenario where there would be 0 lines or 0 branches.

This seems the simplest way to avoid the red 0% on files that don't contain any functions.

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.

1 participant