
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
apex-code-coverage-transformer
Advanced tools
Transforms the Apex Code Coverage JSON into the Generic Test Data Report.
The apex-code-coverage-transformer
is a simple Salesforce CLI plugin to transform the Apex Code Coverage JSON file into Generic Test Coverage Format (XML). This format is accepted by static code analysis tools like SonarQube.
This plugin supports code coverage metrics created for Apex Classes, Apex Triggers, and Flows (if flows are deployed as active in your org). This also supports multiple package directories as listed in your project's sfdx-project.json
configuration, assuming unique file-names are used in your package directories.
To create the code coverage JSON during a Salesforce CLI deployment/validation, append --coverage-formatters json --results-dir coverage
to the sf project deploy
command:
sf project deploy validate -x manifest/package.xml -l RunSpecifiedTests -t {testclasses} --verbose --coverage-formatters json --results-dir coverage
This will create a coverage JSON in this relative path - coverage/coverage/coverage.json
This JSON isn't accepted by SonarQube automatically and needs to be converted using this plugin.
Note: This has been tested and confirmed on code which meets 100% coverage.
sf plugins install apex-code-coverage-transformer@x.y.z
The apex-code-coverage-transformer
has 1 command:
sf apex-code-coverage transformer transform
Recommend running this command in the same directory that your sfdx-project.json
file is located in. This command will use the packageDirectories
in the JSON file to set the file-paths in the coverage file.
sf apex-code-coverage transformer transform
USAGE
$ sf apex-code-coverage transformer transform -j <value> -x <value> -c <value> [--json]
FLAGS
-j, --coverage-json=<value> The path to the JSON file created by the Salesforce CLI for code coverage.
-x, --xml=<value> [default: coverage.xml] Output path for the XML file created by this plugin
-c, --sfdx-configuration=<value> [default: 'sfdx-project.json' in the current working directory] The path to your Salesforce DX configuration file, 'sfdx-project.json'.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
This plugin will convert the JSON file created by the Salesforce CLI during Apex deployments into the Generic Test Coverage Format.
EXAMPLES
$ apex-code-coverage transformer transform -j "test.json" -x "coverage.xml" -c "sfdx-project.json"
This code coverage JSON file created by the Salesforce CLI will be transformed into:
<?xml version="1.0"?>
<coverage version="1">
<file path="force-app\main\default\triggers\AccountTrigger.trigger">
<lineToCover lineNumber="52" covered="false"/>
<lineToCover lineNumber="53" covered="false"/>
<lineToCover lineNumber="59" covered="false"/>
<lineToCover lineNumber="60" covered="false"/>
</file>
<file path="force-app\main\default\classes\AccountProfile.cls">
<lineToCover lineNumber="52" covered="false"/>
<lineToCover lineNumber="53" covered="false"/>
<lineToCover lineNumber="59" covered="false"/>
<lineToCover lineNumber="60" covered="false"/>
</file>
<file path="force-app\main\default\flows\Get_Info.flow-meta.xml">
<lineToCover lineNumber="52" covered="false"/>
<lineToCover lineNumber="53" covered="false"/>
<lineToCover lineNumber="59" covered="false"/>
<lineToCover lineNumber="60" covered="false"/>
</file>
</coverage>
1.6.0-beta.1 (2024-03-20)
covered
lines, renumbering out-of-range lines numbers (1733b09)FAQs
Transform Salesforce Apex code coverage JSONs into other formats accepted by SonarQube, GitHub, GitLab, Azure, Bitbucket, etc.
The npm package apex-code-coverage-transformer receives a total of 1,299 weekly downloads. As such, apex-code-coverage-transformer popularity was classified as popular.
We found that apex-code-coverage-transformer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.