Skip to content

coverage isn't supported out of the box #319

Open
@akaihola

Description

@akaihola

Problem

Darker doesn't support reporting missing test coverage on modified lines out of the box. The cov_to_lint.py script can be used as a linter with darker --lint cov_to_lint.py and it will convert the .coverage SQLite output to a lint output format which Darker understands. But cov_to_lint.py isn't pip installable, and the Darker command line syntax is a bit ugly.

Solution

darker --coverage . to read the .coverage file and report missing coverage on modified lines.

Maybe we could also support specifying the coverage file e.g. with darker --coverage=mycoverage.sqlite ..

Alternatives

We could package cov_to_lint.py so it would be installable using pip install cov-to-lint or even pip install darker[cov-to-lint], and runnable with darker --lint cov-to-lint.

Other

The usual workflow in CI and locally e.g. with pre-commit would be

  • run pytest --cov=mypackage
  • run darker --coverage .

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions