Commit 12f8beb
committed
fix: make strict-no-cover functional and add test pragma
Two issues prevented strict-no-cover from detecting unnecessary pragmas:
1. Coverage 7.13.x changed analysis_from_file_reporter to filter executed
lines with '& statements', which removes excluded lines from the
executed set. This breaks strict-no-cover's detection (it checks the
intersection of excluded_lines and executed_lines). Pin to <7.13.
2. relative_files = true causes coverage to store relative paths, but
strict-no-cover creates a temp rcfile without [tool.coverage.run]
settings. Without relative_files in that temp config, coverage can't
match paths, resulting in empty executed_lines.
Also adds a test pragma on a covered line to verify the check fails.1 parent d078fcd commit 12f8beb
3 files changed
+98
-99
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | 204 | | |
206 | 205 | | |
207 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments