apex-code-coverage-transformer 2.2.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +194 -13
  3. package/lib/commands/acc-transformer/transform.d.ts +1 -0
  4. package/lib/commands/acc-transformer/transform.js +12 -2
  5. package/lib/commands/acc-transformer/transform.js.map +1 -1
  6. package/lib/helpers/constants.d.ts +1 -0
  7. package/lib/helpers/constants.js +2 -0
  8. package/lib/helpers/constants.js.map +1 -0
  9. package/lib/helpers/generateXml.d.ts +2 -0
  10. package/lib/helpers/generateXml.js +14 -0
  11. package/lib/helpers/generateXml.js.map +1 -0
  12. package/lib/helpers/initializeCoverageObject.d.ts +5 -0
  13. package/lib/helpers/initializeCoverageObject.js +68 -0
  14. package/lib/helpers/initializeCoverageObject.js.map +1 -0
  15. package/lib/helpers/setCoveredLinesClover.d.ts +2 -0
  16. package/lib/helpers/setCoveredLinesClover.js +43 -0
  17. package/lib/helpers/setCoveredLinesClover.js.map +1 -0
  18. package/lib/helpers/setCoveredLinesCobertura.d.ts +2 -0
  19. package/lib/helpers/setCoveredLinesCobertura.js +34 -0
  20. package/lib/helpers/setCoveredLinesCobertura.js.map +1 -0
  21. package/lib/helpers/setCoveredLinesSonar.d.ts +2 -0
  22. package/lib/helpers/{setCoveredLines.js → setCoveredLinesSonar.js} +2 -2
  23. package/lib/helpers/setCoveredLinesSonar.js.map +1 -0
  24. package/lib/helpers/transformDeployCoverageReport.d.ts +1 -1
  25. package/lib/helpers/transformDeployCoverageReport.js +88 -16
  26. package/lib/helpers/transformDeployCoverageReport.js.map +1 -1
  27. package/lib/helpers/transformTestCoverageReport.d.ts +1 -1
  28. package/lib/helpers/transformTestCoverageReport.js +97 -20
  29. package/lib/helpers/transformTestCoverageReport.js.map +1 -1
  30. package/lib/helpers/types.d.ts +96 -6
  31. package/lib/hooks/postrun.js +3 -0
  32. package/lib/hooks/postrun.js.map +1 -1
  33. package/messages/transformer.transform.md +11 -5
  34. package/oclif.manifest.json +23 -6
  35. package/package.json +11 -3
  36. package/lib/helpers/setCoveredLines.d.ts +0 -2
  37. package/lib/helpers/setCoveredLines.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@
5
5
 
6
6
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
7
7
 
8
+ ## [2.4.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.3.0...v2.4.0) (2024-12-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * add support for clover format ([00ffa74](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/00ffa742455609028f36d48f9a4cabc86aa32ecb))
14
+
15
+ ## [2.3.0](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.1...v2.3.0) (2024-12-17)
16
+
17
+
18
+ ### Features
19
+
20
+ * add support for cobertura format ([41a3b25](https://github.com/mcarvin8/apex-code-coverage-transformer/commit/41a3b2583ce1014ccd04f935c5c8b87831bee2e7))
21
+
8
22
  ## [2.2.1](https://github.com/mcarvin8/apex-code-coverage-transformer/compare/v2.2.0...v2.2.1) (2024-12-14)
9
23
 
10
24
 
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  - [License](#license)
19
19
  </details>
20
20
 
21
- A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into the generic test coverage format (XML) accepted by SonarQube.
21
+ A Salesforce CLI plugin to transform the Apex code coverage JSON files created during deployments and test runs into SonarQube, Cobertura, or Clover format.
22
22
 
23
23
  ## Install
24
24
 
@@ -28,15 +28,17 @@ sf plugins install apex-code-coverage-transformer@x.y.z
28
28
 
29
29
  ## Who is the Plugin For?
30
30
 
31
- This plugin is intended for users who deploy their Apex codebase (Apex classes and triggers) from any Salesforce DX repository (`sfdx-project.json` file), not just git-based ones. You should be running this plugin somewhere inside your Salesforce DX repository (root folder preferred). This plugin searches for your repository's `sfdx-project.json` file to know which package directories to search into. Since SonarQube relies on file-paths to map code coverage to the files in their explorer interface, the Apex files must be found in one of your package directories.
31
+ This plugin is intended for users who deploy their Apex codebase (Apex classes and triggers) from any Salesforce DX repository (`sfdx-project.json` file), not just git-based ones. You should be running this plugin somewhere inside your Salesforce DX repository (root folder preferred). This plugin searches for your repository's `sfdx-project.json` file to know which package directories to search into. The Apex files must be found in one of your package directories.
32
32
 
33
- This plugin will work if you run local tests or run all tests in an org, including tests that originate from installed managed and unlocked packages. Since files from managed and unlocked packages aren't retrieved into Salesforce DX repositories, these files cannot be included in your SonarQube scans.
33
+ This plugin will work if you run local tests or run all tests in an org, including tests that originate from installed managed and unlocked packages. Since files from managed and unlocked packages aren't retrieved into Salesforce DX repositories, these files cannot be included in your code coverage reports.
34
34
 
35
- When the plugin is unable to find the Apex file from the coverage report in your repository, it will print a warning and not add that file's coverage data to the coverage XML created by this plugin. A warning will be printed for each file not found in a package directory in your repository. See [Errors and Warnings](https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#errors-and-warnings) for more information.
35
+ When the plugin is unable to find the Apex file from the Salesforce CLI coverage report in your repository, it will print a warning and not add that file's coverage data to the coverage XML created by this plugin. A warning will be printed for each file not found in a package directory in your repository. See [Errors and Warnings](https://github.com/mcarvin8/apex-code-coverage-transformer?tab=readme-ov-file#errors-and-warnings) for more information.
36
36
 
37
37
  ## Creating Code Coverage Files with the Salesforce CLI
38
38
 
39
- 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. This will create a coverage JSON in this relative path - `coverage/coverage/coverage.json`.
39
+ **This tool will only support the "json" coverage format from the Salesforce CLI. Do not use the "json-summary", "clover", or "cobertura" format from the Salesforce CLI.**
40
+
41
+ To create the code coverage JSON when deploying or validating, append `--coverage-formatters json --results-dir "coverage"` to the `sf project deploy` command. This will create a coverage JSON in this relative path - `coverage/coverage/coverage.json`.
40
42
 
41
43
  ```
42
44
  sf project deploy [start/validate] --coverage-formatters json --results-dir "coverage"
@@ -49,7 +51,7 @@ sf apex run test --code-coverage --result-format json --output-dir "coverage"
49
51
  sf apex get test --test-run-id <test run id> --code-coverage --result-format json --output-dir "coverage"
50
52
  ```
51
53
 
52
- The code coverage JSONs created by the Salesforce CLI aren't accepted by SonarQube automatically for Salesforce DX repositories and needs to be converted using this plugin.
54
+ The code coverage JSONs created by the Salesforce CLI aren't accepted automatically for Salesforce DX repositories and needs to be converted using this plugin.
53
55
 
54
56
  **Disclaimer**: Due to existing bugs with how the Salesforce CLI reports covered lines during deployments (see [5511](https://github.com/forcedotcom/salesforcedx-vscode/issues/5511) and [1568](https://github.com/forcedotcom/cli/issues/1568)), to add support for covered lines in this plugin for deployment coverage files, I had to add a function to re-number out-of-range covered lines the CLI may report (ex: line 100 in a 98-line Apex Class is reported back as covered by the Salesforce CLI deploy command). Salesforce's coverage result may also include extra lines as covered (ex: 120 lines are included in the coverage report for a 100 line file), so the coverage percentage may vary based on how many lines the API returns in the coverage report. Once Salesforce fixes the API to correctly return covered lines in the deploy command, this function will be removed.
55
57
 
@@ -63,20 +65,28 @@ The `apex-code-coverage-transformer` has 1 command:
63
65
 
64
66
  ```
65
67
  USAGE
66
- $ sf acc-transformer transform -j <value> -x <value> [--json]
68
+ $ sf acc-transformer transform -j <value> -x <value> -f <value> [--json]
67
69
 
68
70
  FLAGS
69
- -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deployment or test command.
70
- -x, --xml=<value> [default: "coverage.xml"] Path to code coverage XML file that will be created by this plugin.
71
+ -j, --coverage-json=<value> Path to the code coverage JSON file created by the Salesforce CLI deploy or test command.
72
+ -x, --xml=<value> Path to the code coverage XML file that will be created by this plugin.
73
+ [default: "coverage.xml"]
74
+ -f, --format=<value> Output format for the code coverage format.
75
+ Valid options are "sonar", "clover", or "cobertura".
76
+ [default: "sonar"]
71
77
 
72
78
  GLOBAL FLAGS
73
79
  --json Format output as json.
74
80
 
75
81
  DESCRIPTION
76
- This plugin will convert the code coverage JSON file created by the Salesforce CLI during Apex deployments and test runs into an XML accepted by tools like SonarQube.
82
+ Transform the Apex code coverage JSON file created by the Salesforce CLI deploy and test command into SonarQube, Clover, or Cobertura format.
77
83
 
78
84
  EXAMPLES
79
- $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml"
85
+ $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "sonar"
86
+
87
+ $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "cobertura"
88
+
89
+ $ sf acc-transformer transform -j "coverage.json" -x "coverage.xml" -f "clover"
80
90
  ```
81
91
 
82
92
  ## Hook
@@ -93,13 +103,15 @@ The `.apexcodecovtransformer.config.json` should look like this:
93
103
  {
94
104
  "deployCoverageJsonPath": "coverage/coverage/coverage.json",
95
105
  "testCoverageJsonPath": "coverage/test-coverage.json",
96
- "coverageXmlPath": "coverage.xml"
106
+ "coverageXmlPath": "coverage.xml",
107
+ "format": "sonar"
97
108
  }
98
109
  ```
99
110
 
100
111
  - `deployCoverageJsonPath` is required to use the hook after deployments and should be the path to the code coverage JSON created by the Salesforce CLI deployment command. Recommend using a relative path.
101
112
  - `testCoverageJsonPath` is required to use the hook after test runs and should be the path to the code coverage JSON created by the Salesforce CLI test command. Recommend using a relative path.
102
113
  - `coverageXmlPath` is optional and should be the path to the code coverage XML created by this plugin. Recommend using a relative path. If this isn't provided, it will default to `coverage.xml` in the working directory.
114
+ - `format` is optional and should be the intended output format for the code coverage XML created by this plugin. Options are "sonar", "clover", or "cobertura". If this isn't provided, it will default to "sonar".
103
115
 
104
116
  If the `.apexcodecovtransformer.config.json` file isn't found, the hook will be skipped.
105
117
 
@@ -141,7 +153,7 @@ Error (1): ENOENT: no such file or directory: {packageDirPath}
141
153
 
142
154
  ## Example
143
155
 
144
- This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment will be transformed into:
156
+ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-code-coverage-transformer/main/test/deploy_coverage_no_file_exts.json) created during a Salesforce CLI deployment will be transformed into this format for SonarQube:
145
157
 
146
158
  ```xml
147
159
  <?xml version="1.0"?>
@@ -215,6 +227,175 @@ This [code coverage JSON file](https://raw.githubusercontent.com/mcarvin8/apex-c
215
227
  </coverage>
216
228
  ```
217
229
 
230
+ and this format for Cobertura:
231
+
232
+ ```xml
233
+ <?xml version="1.0" ?>
234
+ <!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
235
+ <coverage lines-valid="62" lines-covered="54" line-rate="0.871" branches-valid="0" branches-covered="0" branch-rate="1" timestamp="1734621101529" complexity="0" version="0.1">
236
+ <sources>
237
+ <source>.</source>
238
+ </sources>
239
+ <packages>
240
+ <package name="main" line-rate="0.871" branch-rate="1">
241
+ <classes>
242
+ <class name="AccountTrigger" filename="packaged/triggers/AccountTrigger.trigger" line-rate="0.8710" branch-rate="1">
243
+ <methods/>
244
+ <lines>
245
+ <line number="52" hits="0" branch="false"/>
246
+ <line number="53" hits="0" branch="false"/>
247
+ <line number="59" hits="0" branch="false"/>
248
+ <line number="60" hits="0" branch="false"/>
249
+ <line number="1" hits="1" branch="false"/>
250
+ <line number="2" hits="1" branch="false"/>
251
+ <line number="3" hits="1" branch="false"/>
252
+ <line number="4" hits="1" branch="false"/>
253
+ <line number="5" hits="1" branch="false"/>
254
+ <line number="6" hits="1" branch="false"/>
255
+ <line number="7" hits="1" branch="false"/>
256
+ <line number="8" hits="1" branch="false"/>
257
+ <line number="9" hits="1" branch="false"/>
258
+ <line number="10" hits="1" branch="false"/>
259
+ <line number="11" hits="1" branch="false"/>
260
+ <line number="12" hits="1" branch="false"/>
261
+ <line number="13" hits="1" branch="false"/>
262
+ <line number="14" hits="1" branch="false"/>
263
+ <line number="15" hits="1" branch="false"/>
264
+ <line number="16" hits="1" branch="false"/>
265
+ <line number="17" hits="1" branch="false"/>
266
+ <line number="18" hits="1" branch="false"/>
267
+ <line number="19" hits="1" branch="false"/>
268
+ <line number="20" hits="1" branch="false"/>
269
+ <line number="21" hits="1" branch="false"/>
270
+ <line number="22" hits="1" branch="false"/>
271
+ <line number="23" hits="1" branch="false"/>
272
+ <line number="24" hits="1" branch="false"/>
273
+ <line number="25" hits="1" branch="false"/>
274
+ <line number="26" hits="1" branch="false"/>
275
+ <line number="27" hits="1" branch="false"/>
276
+ </lines>
277
+ </class>
278
+ <class name="AccountProfile" filename="force-app/main/default/classes/AccountProfile.cls" line-rate="0.8710" branch-rate="1">
279
+ <methods/>
280
+ <lines>
281
+ <line number="52" hits="0" branch="false"/>
282
+ <line number="53" hits="0" branch="false"/>
283
+ <line number="59" hits="0" branch="false"/>
284
+ <line number="60" hits="0" branch="false"/>
285
+ <line number="54" hits="1" branch="false"/>
286
+ <line number="55" hits="1" branch="false"/>
287
+ <line number="56" hits="1" branch="false"/>
288
+ <line number="57" hits="1" branch="false"/>
289
+ <line number="58" hits="1" branch="false"/>
290
+ <line number="61" hits="1" branch="false"/>
291
+ <line number="62" hits="1" branch="false"/>
292
+ <line number="63" hits="1" branch="false"/>
293
+ <line number="64" hits="1" branch="false"/>
294
+ <line number="65" hits="1" branch="false"/>
295
+ <line number="66" hits="1" branch="false"/>
296
+ <line number="67" hits="1" branch="false"/>
297
+ <line number="68" hits="1" branch="false"/>
298
+ <line number="69" hits="1" branch="false"/>
299
+ <line number="70" hits="1" branch="false"/>
300
+ <line number="71" hits="1" branch="false"/>
301
+ <line number="72" hits="1" branch="false"/>
302
+ <line number="1" hits="1" branch="false"/>
303
+ <line number="2" hits="1" branch="false"/>
304
+ <line number="3" hits="1" branch="false"/>
305
+ <line number="4" hits="1" branch="false"/>
306
+ <line number="5" hits="1" branch="false"/>
307
+ <line number="6" hits="1" branch="false"/>
308
+ <line number="7" hits="1" branch="false"/>
309
+ <line number="8" hits="1" branch="false"/>
310
+ <line number="9" hits="1" branch="false"/>
311
+ <line number="10" hits="1" branch="false"/>
312
+ </lines>
313
+ </class>
314
+ </classes>
315
+ </package>
316
+ </packages>
317
+ </coverage>
318
+ ```
319
+
320
+ and this format for Clover:
321
+
322
+ ```xml
323
+ <?xml version="1.0" encoding="UTF-8"?>
324
+ <coverage generated="1734733618708" clover="3.2.0">
325
+ <project timestamp="1734733618708" name="All files">
326
+ <metrics statements="62" coveredstatements="54" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="62" coveredelements="54" complexity="0" loc="62" ncloc="62" packages="1" files="2" classes="2"/>
327
+ <file name="AccountTrigger" path="packaged/triggers/AccountTrigger.trigger">
328
+ <metrics statements="62" coveredstatements="54" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
329
+ <line num="52" count="0" type="stmt"/>
330
+ <line num="53" count="0" type="stmt"/>
331
+ <line num="59" count="0" type="stmt"/>
332
+ <line num="60" count="0" type="stmt"/>
333
+ <line num="1" count="1" type="stmt"/>
334
+ <line num="2" count="1" type="stmt"/>
335
+ <line num="3" count="1" type="stmt"/>
336
+ <line num="4" count="1" type="stmt"/>
337
+ <line num="5" count="1" type="stmt"/>
338
+ <line num="6" count="1" type="stmt"/>
339
+ <line num="7" count="1" type="stmt"/>
340
+ <line num="8" count="1" type="stmt"/>
341
+ <line num="9" count="1" type="stmt"/>
342
+ <line num="10" count="1" type="stmt"/>
343
+ <line num="11" count="1" type="stmt"/>
344
+ <line num="12" count="1" type="stmt"/>
345
+ <line num="13" count="1" type="stmt"/>
346
+ <line num="14" count="1" type="stmt"/>
347
+ <line num="15" count="1" type="stmt"/>
348
+ <line num="16" count="1" type="stmt"/>
349
+ <line num="17" count="1" type="stmt"/>
350
+ <line num="18" count="1" type="stmt"/>
351
+ <line num="19" count="1" type="stmt"/>
352
+ <line num="20" count="1" type="stmt"/>
353
+ <line num="21" count="1" type="stmt"/>
354
+ <line num="22" count="1" type="stmt"/>
355
+ <line num="23" count="1" type="stmt"/>
356
+ <line num="24" count="1" type="stmt"/>
357
+ <line num="25" count="1" type="stmt"/>
358
+ <line num="26" count="1" type="stmt"/>
359
+ <line num="27" count="1" type="stmt"/>
360
+ </file>
361
+ <file name="AccountProfile" path="force-app/main/default/classes/AccountProfile.cls">
362
+ <metrics statements="62" coveredstatements="54" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
363
+ <line num="52" count="0" type="stmt"/>
364
+ <line num="53" count="0" type="stmt"/>
365
+ <line num="59" count="0" type="stmt"/>
366
+ <line num="60" count="0" type="stmt"/>
367
+ <line num="54" count="1" type="stmt"/>
368
+ <line num="55" count="1" type="stmt"/>
369
+ <line num="56" count="1" type="stmt"/>
370
+ <line num="57" count="1" type="stmt"/>
371
+ <line num="58" count="1" type="stmt"/>
372
+ <line num="61" count="1" type="stmt"/>
373
+ <line num="62" count="1" type="stmt"/>
374
+ <line num="63" count="1" type="stmt"/>
375
+ <line num="64" count="1" type="stmt"/>
376
+ <line num="65" count="1" type="stmt"/>
377
+ <line num="66" count="1" type="stmt"/>
378
+ <line num="67" count="1" type="stmt"/>
379
+ <line num="68" count="1" type="stmt"/>
380
+ <line num="69" count="1" type="stmt"/>
381
+ <line num="70" count="1" type="stmt"/>
382
+ <line num="71" count="1" type="stmt"/>
383
+ <line num="72" count="1" type="stmt"/>
384
+ <line num="1" count="1" type="stmt"/>
385
+ <line num="2" count="1" type="stmt"/>
386
+ <line num="3" count="1" type="stmt"/>
387
+ <line num="4" count="1" type="stmt"/>
388
+ <line num="5" count="1" type="stmt"/>
389
+ <line num="6" count="1" type="stmt"/>
390
+ <line num="7" count="1" type="stmt"/>
391
+ <line num="8" count="1" type="stmt"/>
392
+ <line num="9" count="1" type="stmt"/>
393
+ <line num="10" count="1" type="stmt"/>
394
+ </file>
395
+ </project>
396
+ </coverage>
397
+ ```
398
+
218
399
  ## Issues
219
400
 
220
401
  If you encounter any issues, please create an issue in the repository's [issue tracker](https://github.com/mcarvin8/apex-code-coverage-transformer/issues). Please also create issues to suggest any new features.
@@ -7,6 +7,7 @@ export default class TransformerTransform extends SfCommand<TransformerTransform
7
7
  static readonly flags: {
8
8
  'coverage-json': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
9
  xml: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
11
  };
11
12
  run(): Promise<TransformerTransformResult>;
12
13
  }
@@ -6,6 +6,7 @@ import { Messages } from '@salesforce/core';
6
6
  import { transformDeployCoverageReport } from '../../helpers/transformDeployCoverageReport.js';
7
7
  import { transformTestCoverageReport } from '../../helpers/transformTestCoverageReport.js';
8
8
  import { checkCoverageDataType } from '../../helpers/setCoverageDataType.js';
9
+ import { formatOptions } from '../../helpers/constants.js';
9
10
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
11
  const messages = Messages.loadMessages('apex-code-coverage-transformer', 'transformer.transform');
11
12
  export default class TransformerTransform extends SfCommand {
@@ -26,11 +27,20 @@ export default class TransformerTransform extends SfCommand {
26
27
  exists: false,
27
28
  default: 'coverage.xml',
28
29
  }),
30
+ format: Flags.string({
31
+ summary: messages.getMessage('flags.format.summary'),
32
+ char: 'f',
33
+ required: true,
34
+ multiple: false,
35
+ default: 'sonar',
36
+ options: formatOptions,
37
+ }),
29
38
  };
30
39
  async run() {
31
40
  const { flags } = await this.parse(TransformerTransform);
32
41
  const jsonFilePath = resolve(flags['coverage-json']);
33
42
  const xmlFilePath = resolve(flags['xml']);
43
+ const format = flags['format'];
34
44
  const jsonData = await readFile(jsonFilePath, 'utf-8');
35
45
  let xmlData;
36
46
  let warnings = [];
@@ -39,13 +49,13 @@ export default class TransformerTransform extends SfCommand {
39
49
  const commandType = checkCoverageDataType(parsedData);
40
50
  // Determine the type of coverage data using type guards
41
51
  if (commandType === 'TestCoverageData') {
42
- const result = await transformTestCoverageReport(parsedData);
52
+ const result = await transformTestCoverageReport(parsedData, format);
43
53
  xmlData = result.xml;
44
54
  warnings = result.warnings;
45
55
  filesProcessed = result.filesProcessed;
46
56
  }
47
57
  else if (commandType === 'DeployCoverageData') {
48
- const result = await transformDeployCoverageReport(parsedData);
58
+ const result = await transformDeployCoverageReport(parsedData, format);
49
59
  xmlData = result.xml;
50
60
  warnings = result.warnings;
51
61
  filesProcessed = result.filesProcessed;
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/commands/acc-transformer/transform.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,gCAAgC,EAAE,uBAAuB,CAAC,CAAC;AAElG,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,SAAqC;IAC9E,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAE5D,MAAM,CAAU,KAAK,GAAG;QAC7B,eAAe,EAAE,KA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GAAG,CAAC,EAAE,CAAC;YACxB,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,IAAI,cAAc,KAAK,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;QAC7G,CAAC;QAED,MAAM,SAAS,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAC;QAChE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;IAC/B,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const formatOptions: string[];
@@ -0,0 +1,2 @@
1
+ export const formatOptions = ['sonar', 'cobertura', 'clover'];
2
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/helpers/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAa,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SonarCoverageObject, CoberturaCoverageObject, CloverCoverageObject } from './types.js';
2
+ export declare function generateXml(coverageObj: SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject, format: string): string;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+ import { create } from 'xmlbuilder2';
3
+ export function generateXml(coverageObj, format) {
4
+ const isHeadless = format === 'cobertura' || format === 'clover';
5
+ let xml = create(coverageObj).end({ prettyPrint: true, indent: ' ', headless: isHeadless });
6
+ if (format === 'cobertura') {
7
+ xml = `<?xml version="1.0" ?>\n<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">\n${xml}`;
8
+ }
9
+ else if (format === 'clover') {
10
+ xml = `<?xml version="1.0" encoding="UTF-8"?>\n${xml}`;
11
+ }
12
+ return xml;
13
+ }
14
+ //# sourceMappingURL=generateXml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateXml.js","sourceRoot":"","sources":["../../src/helpers/generateXml.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,UAAU,WAAW,CACzB,WAAiF,EACjF,MAAc;IAEd,MAAM,UAAU,GAAG,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,QAAQ,CAAC;IACjE,IAAI,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IAE7F,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAC3B,GAAG,GAAG,8GAA8G,GAAG,EAAE,CAAC;IAC5H,CAAC;SAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,GAAG,GAAG,2CAA2C,GAAG,EAAE,CAAC;IACzD,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { SonarCoverageObject, CoberturaCoverageObject, CloverCoverageObject, CoberturaPackage } from './types.js';
2
+ export declare function initializeCoverageObject(format: string): {
3
+ coverageObj: SonarCoverageObject | CoberturaCoverageObject | CloverCoverageObject;
4
+ packageObj: CoberturaPackage | null;
5
+ };
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+ export function initializeCoverageObject(format) {
3
+ let coverageObj;
4
+ if (format === 'sonar') {
5
+ coverageObj = {
6
+ coverage: { '@version': '1', file: [] },
7
+ };
8
+ }
9
+ else if (format === 'cobertura') {
10
+ coverageObj = {
11
+ coverage: {
12
+ '@lines-valid': 0,
13
+ '@lines-covered': 0,
14
+ '@line-rate': 0,
15
+ '@branches-valid': 0,
16
+ '@branches-covered': 0,
17
+ '@branch-rate': 1,
18
+ '@timestamp': Date.now(),
19
+ '@complexity': 0,
20
+ '@version': '0.1',
21
+ sources: { source: ['.'] },
22
+ packages: { package: [] },
23
+ },
24
+ };
25
+ }
26
+ else {
27
+ coverageObj = {
28
+ coverage: {
29
+ '@generated': Date.now(),
30
+ '@clover': '3.2.0',
31
+ project: {
32
+ '@timestamp': Date.now(),
33
+ '@name': 'All files',
34
+ metrics: {
35
+ '@statements': 0,
36
+ '@coveredstatements': 0,
37
+ '@conditionals': 0,
38
+ '@coveredconditionals': 0,
39
+ '@methods': 0,
40
+ '@coveredmethods': 0,
41
+ '@elements': 0,
42
+ '@coveredelements': 0,
43
+ '@complexity': 0,
44
+ '@loc': 0,
45
+ '@ncloc': 0,
46
+ '@packages': 1,
47
+ '@files': 0,
48
+ '@classes': 0,
49
+ },
50
+ file: [],
51
+ },
52
+ },
53
+ };
54
+ }
55
+ const packageObj = format === 'cobertura'
56
+ ? {
57
+ '@name': 'main',
58
+ '@line-rate': 0,
59
+ '@branch-rate': 1,
60
+ classes: { class: [] },
61
+ }
62
+ : null;
63
+ if (packageObj) {
64
+ coverageObj.coverage.packages.package.push(packageObj);
65
+ }
66
+ return { coverageObj, packageObj };
67
+ }
68
+ //# sourceMappingURL=initializeCoverageObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeCoverageObject.js","sourceRoot":"","sources":["../../src/helpers/initializeCoverageObject.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAUb,MAAM,UAAU,wBAAwB,CAAC,MAAc;IAIrD,IAAI,WAAiF,CAAC;IAEtF,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,WAAW,GAAG;YACZ,QAAQ,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE;SACjB,CAAC;IAC3B,CAAC;SAAM,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAClC,WAAW,GAAG;YACZ,QAAQ,EAAE;gBAC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AAC,IAAI,CAAC;IAEX,IAAI,UAAU,EAAE,CAAC;QACd,WAAuC,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CloverFile } from './types.js';
2
+ export declare function setCoveredLinesClover(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj: CloverFile): Promise<void>;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+ /* eslint-disable no-param-reassign */
3
+ import { join } from 'node:path';
4
+ import { getTotalLines } from './getTotalLines.js';
5
+ export async function setCoveredLinesClover(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
6
+ const randomLines = [];
7
+ const totalLines = await getTotalLines(join(repoRoot, filePath));
8
+ for (const coveredLine of coveredLines) {
9
+ if (coveredLine > totalLines) {
10
+ for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
11
+ if (!uncoveredLines.includes(randomLineNumber) &&
12
+ !coveredLines.includes(randomLineNumber) &&
13
+ !randomLines.includes(randomLineNumber)) {
14
+ const randomLine = {
15
+ '@num': randomLineNumber,
16
+ '@count': 1,
17
+ '@type': 'stmt',
18
+ };
19
+ fileObj.line.push(randomLine);
20
+ randomLines.push(randomLineNumber);
21
+ break;
22
+ }
23
+ }
24
+ }
25
+ else {
26
+ const coveredLineObj = {
27
+ '@num': coveredLine,
28
+ '@count': 1,
29
+ '@type': 'stmt',
30
+ };
31
+ fileObj.line.push(coveredLineObj);
32
+ }
33
+ }
34
+ // Update Clover file-level metrics
35
+ fileObj.metrics['@statements'] += coveredLines.length + uncoveredLines.length;
36
+ fileObj.metrics['@coveredstatements'] += coveredLines.length;
37
+ // Optionally calculate derived metrics
38
+ fileObj.metrics['@conditionals'] ??= 0; // Add default if missing
39
+ fileObj.metrics['@coveredconditionals'] ??= 0;
40
+ fileObj.metrics['@methods'] ??= 0;
41
+ fileObj.metrics['@coveredmethods'] ??= 0;
42
+ }
43
+ //# sourceMappingURL=setCoveredLinesClover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCoveredLinesClover.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesClover.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,sCAAsC;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,MAAM,UAAU,GAAe;wBAC7B,MAAM,EAAE,gBAAgB;wBACxB,QAAQ,EAAE,CAAC;wBACX,OAAO,EAAE,MAAM;qBAChB,CAAC;oBACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAC9B,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAe;gBACjC,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,CAAC;gBACX,OAAO,EAAE,MAAM;aAChB,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,mCAAmC;IACnC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC;IAC9E,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC;IAE7D,uCAAuC;IACvC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,yBAAyB;IACjE,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC9C,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { CoberturaClass } from './types.js';
2
+ export declare function setCoveredLinesCobertura(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, classObj: CoberturaClass): Promise<void>;
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+ import { join } from 'node:path';
3
+ import { getTotalLines } from './getTotalLines.js';
4
+ export async function setCoveredLinesCobertura(coveredLines, uncoveredLines, repoRoot, filePath, classObj) {
5
+ const randomLines = [];
6
+ const totalLines = await getTotalLines(join(repoRoot, filePath));
7
+ for (const coveredLine of coveredLines) {
8
+ if (coveredLine > totalLines) {
9
+ for (let randomLineNumber = 1; randomLineNumber <= totalLines; randomLineNumber++) {
10
+ if (!uncoveredLines.includes(randomLineNumber) &&
11
+ !coveredLines.includes(randomLineNumber) &&
12
+ !randomLines.includes(randomLineNumber)) {
13
+ const randomLine = {
14
+ '@number': randomLineNumber,
15
+ '@hits': 1,
16
+ '@branch': 'false',
17
+ };
18
+ classObj.lines.line.push(randomLine);
19
+ randomLines.push(randomLineNumber);
20
+ break;
21
+ }
22
+ }
23
+ }
24
+ else {
25
+ const coveredLineObj = {
26
+ '@number': coveredLine,
27
+ '@hits': 1,
28
+ '@branch': 'false',
29
+ };
30
+ classObj.lines.line.push(coveredLineObj);
31
+ }
32
+ }
33
+ }
34
+ //# sourceMappingURL=setCoveredLinesCobertura.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCoveredLinesCobertura.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesCobertura.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,QAAwB;IAExB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,MAAM,UAAU,GAAkB;wBAChC,SAAS,EAAE,gBAAgB;wBAC3B,OAAO,EAAE,CAAC;wBACV,SAAS,EAAE,OAAO;qBACnB,CAAC;oBACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACrC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAkB;gBACpC,SAAS,EAAE,WAAW;gBACtB,OAAO,EAAE,CAAC;gBACV,SAAS,EAAE,OAAO;aACnB,CAAC;YACF,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SonarClass } from './types.js';
2
+ export declare function setCoveredLinesSonar(coveredLines: number[], uncoveredLines: number[], repoRoot: string, filePath: string, fileObj: SonarClass): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  import { join } from 'node:path';
3
3
  import { getTotalLines } from './getTotalLines.js';
4
- export async function setCoveredLines(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
4
+ export async function setCoveredLinesSonar(coveredLines, uncoveredLines, repoRoot, filePath, fileObj) {
5
5
  const randomLines = [];
6
6
  const totalLines = await getTotalLines(join(repoRoot, filePath));
7
7
  for (const coveredLine of coveredLines) {
@@ -27,4 +27,4 @@ export async function setCoveredLines(coveredLines, uncoveredLines, repoRoot, fi
27
27
  }
28
28
  }
29
29
  }
30
- //# sourceMappingURL=setCoveredLines.js.map
30
+ //# sourceMappingURL=setCoveredLinesSonar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setCoveredLinesSonar.js","sourceRoot":"","sources":["../../src/helpers/setCoveredLinesSonar.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAAsB,EACtB,cAAwB,EACxB,QAAgB,EAChB,QAAgB,EAChB,OAAmB;IAEnB,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjE,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,WAAW,GAAG,UAAU,EAAE,CAAC;YAC7B,KAAK,IAAI,gBAAgB,GAAG,CAAC,EAAE,gBAAgB,IAAI,UAAU,EAAE,gBAAgB,EAAE,EAAE,CAAC;gBAClF,IACE,CAAC,cAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBAC1C,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC;oBACxC,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EACvC,CAAC;oBACD,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;wBACvB,aAAa,EAAE,gBAAgB;wBAC/B,UAAU,EAAE,MAAM;qBACnB,CAAC,CAAC;oBACH,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;oBACnC,MAAM;gBACR,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC;gBACvB,aAAa,EAAE,WAAW;gBAC1B,UAAU,EAAE,MAAM;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { DeployCoverageData } from './types.js';
2
- export declare function transformDeployCoverageReport(data: DeployCoverageData): Promise<{
2
+ export declare function transformDeployCoverageReport(data: DeployCoverageData, format: string): Promise<{
3
3
  xml: string;
4
4
  warnings: string[];
5
5
  filesProcessed: number;