You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add expand_coverage_report option to for #270 (#416)
* Add expand_coverage_report option to add missing lines in a coverage report based on the previous line hit score
* run black
* adds .venv to .gitignore
* changes expand-coverage-report argument to use - instead of _
* Revert "changes expand-coverage-report argument to use - instead of _"
This reverts commit 381d2b4.
* changes expand-coverage-report argument to use - instead of _
* documents --expand-coverage-report in README.rst
* adds tests to expand-coverage-report
* fix readme styling issues
* Fix trailing white space on readme 287
Copy file name to clipboardExpand all lines: README.rst
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -274,6 +274,18 @@ It can be enabled by using the ``-q``/``--quiet`` flag:
274
274
275
275
If enabled, the tool will only print errors and failures but no information or warning messages.
276
276
277
+
Compatibility with multi-line statements
278
+
----------------------------------------
279
+
``diff-cover`` relies on the comparison of diff reports and coverage reports, and does not report
280
+
lines that appear in one and not in the other. While diff reports list all lines that changed,
281
+
coverage reports usually list code statements. As a result, a change in a multi-line statement may not be analyzed by ``diff-cover``.
282
+
283
+
As a workaround, you can use the argument ``--expand-coverage-report``: lines not appearing in the coverage reports will be added to them with the same number of hits as the previously reported line. ``diff-cover`` will then perform diff coverage analysis on all changed lines.
284
+
285
+
Notes:
286
+
- This argument is only available for XML coverage reports.
287
+
- This workaround is designed under the assumption that the coverage tool reports untested statements with hits set to 0, and it reports statements based on the opening line.
288
+
277
289
Configuration files
278
290
-------------------
279
291
Both tools allow users to specify the options in a configuration file with `--config-file`/`-c`:
0 commit comments