JSON coverage files should contain a format version · Issue #1732 · nedbat/coveragepy (original) (raw)

Is your feature request related to a problem? Please describe.

When reading and using the coverage file in JSON format, it was found that the meta sections contains a Coverage.py version that was used to generate the coverage metrics and the report, but not the used JSON format version.

Such a format version is present in status.json but not in coverage.json.

It's recommended to split tool versions from file format versions, as file formats might be more stable then tool versions. Or file versions version asynchronously to tool versions (not a recommended workflow - but possible). Alternatively, complex mappings are needed to translate tool versions to file format versions. Moreover, it might not be indicated in release notes or major version number changes, when a file format was changed too.

Describe the solution you'd like

As meta/version is already used, I suggest meta/format to indicate the file format version.

Describe alternatives you've considered

Creating a mapping from tool version to file format version.

Besides this impossible task (except for reading all Git commits ...), having a mapping external to Coverage.py would break the encapsulation and abstraction principle in good programming :).

Additional context

See #1730.

Maybe related