Integrate Code Coverage Formats
Qlty accepts coverage data in multiple formats compatible with various tools and languages.
See Supported Languages and Formats for more information.
In rare cases where Qlty does not appear to support the coverage format you’re using, below are some possible options to pursue:
-
Change the output format
Some coverage tools support either output coverage data in multiple formats, or support conversion to popular formats.
gcovr, for example, supports conversion from a Go-specific format to Clover XML, supported by Qlty.LCOV (files in the form of
*.info,lcov.info,*.lcov) is another popular format supported by Qlty to look out for. -
Write your own parser
Because the Qlty CLI is Open Source, you also have the opportunity to contribute your formatter back to the community. See the parser directory for other examples.
An LLM should be able to produce a simple parser given the pre-existing parsers and an example of the new input format.
The target format, qlty, is described below under Qlty format
-
Contact us
If writing a formatter is not something you’re up for, or you need assistance, feel free to contact us.
Qlty Format
Qlty supports the import of a generic format, named qlty, which can be used as a target for custom conversion of reports from tools that are not directly supported.
Specification
The qlty format follows the JSON Lines text file format, also called newline-delimited JSON. Each line contains one JSON object.
The structure of each JSON object is described using the JSON schema standard, a declarative language that provides a standardized way to describe JSON data.
Following, an example of a consolidated qlty report:
JSON Lines files are generally saved with the .jsonl extension, so it’s recommended to save your
qlty formatted coverage report with this extension.
The path Property
Ideally, the file path for your code coverage report should be relative to your Git project’s root. However, you can transform the path using the universal reporter tool with the --strip-prefix and --add-prefix flags, modifying the final path of the uploaded report.
The hits Property
Depending on the tool used to exercise your code base, a single line could be:
- Irrelevant regarding code coverage (e.g., comments) (“-1”)
- Not covered (“0”)
- Covered, possibly multiple times.
This structure ensures that you can translate and submit coverage reports in a consistent format, regardless of the tool used to generate them.
Uploading a qlty formatted Coverage Report
Uploading a qlty formatted coverage report is no different than uploading a code coverage report in any other format. Follow these steps:
-
Convert your report to the
qltyformat. -
Get your Qlty coverage token from your project’s settings page under the Code Coverage section.
-
Upload the report using Qlty’s coverage reporter:
For explicitness, you can use the --format=qlty flag to specify the format, though qlty will infer it by default:
Need help?
If you need support for a specific code coverage format, contact our support team. We may be able to complete the process within one week.