Skip to content

HTML report is ignored in toml config #588

@triou-harmonicinc

Description

@triou-harmonicinc

Hi,
I had a .toml config file working with the following option: html_report = "coverage-diff.html"

It used to work, but now the option is simply ignored.
I suppose it stopped working with the option deprecation.

However, when I try to specify the format option it's also ignored : `format = "html:coverage-diff.html"

Copilot reports the following analysis:

Bug: format key in [tool.diff_cover] TOML config is silently ignored

Version

diff-cover 9.7.1

Description

Setting format in a pyproject.toml / custom .toml config file under
[tool.diff_cover] has no effect. The HTML (or JSON/Markdown) report is never
generated when the option is provided exclusively through the config file.

Steps to Reproduce

  1. Create a diff_cover.toml:

    [tool.diff_cover]
    compare_branch = "origin/develop"
    format = "html:coverage/coverage-diff.html"
  2. Run:

    diff-cover coverage/lcov.info --config-file=diff_cover.toml
  3. Observe that only the text report is printed to stdout. coverage/coverage-diff.html is not created.

Expected Behavior

coverage/coverage-diff.html is generated, equivalent to passing
--format html:coverage/coverage-diff.html on the CLI.

Actual Behavior

The format value from the TOML is silently discarded. No HTML file is produced.

Root Cause

In diff_cover_tool.py, --format is registered with a non-None default:

parser.add_argument("--format", type=format_type, default="", ...)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions