Skip to content

Commit 8eb8285

Browse files
authored
CHANGE: @W-19582414@ Export ViolationCounts (#342)
1 parent 0da7a40 commit 8eb8285

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

packages/code-analyzer-core/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
"url": "git+https://github.com/forcedotcom/code-analyzer-core.git",
1111
"directory": "packages/code-analyzer-core"
1212
},
13-
"main": "dist/index.js",
13+
"exports": {
14+
".": "./dist/index.js",
15+
"./output-formats": "./dist/output-formats/index.js"
16+
},
1417
"types": "dist/index.d.ts",
1518
"dependencies": {
1619
"@salesforce/code-analyzer-engine-api": "0.28.0-SNAPSHOT",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export type {
2+
ViolationCounts
3+
} from "./results/json-run-results-format"

packages/code-analyzer-core/src/output-formats/results/json-run-results-format.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,35 @@ export type JsonResultsOutput = {
1111
runDir: string
1212

1313
// Object containing the aggregate counts of the violations
14-
violationCounts: {
15-
// The total amount of violations
16-
total: number
14+
violationCounts: ViolationCounts
1715

18-
// The amount of Critical severity level violations
19-
sev1: number
16+
// Object containing the versions of core and engine modules that ran
17+
versions: JsonVersionOutput
2018

21-
// The amount of High severity level violations
22-
sev2: number
19+
// Array of objects containing information about the violations detected
20+
violations: JsonViolationOutput[]
21+
}
22+
/**
23+
* Type representing violation counts by severity level; this is specifically exported externally.
24+
*/
25+
export type ViolationCounts = {
26+
// The total amount of violations
27+
total: number
2328

24-
// The amount of Moderate severity level violations
25-
sev3: number
29+
// The amount of Critical severity level violations
30+
sev1: number
2631

27-
// The amount of Low severity level violations
28-
sev4: number
32+
// The amount of High severity level violations
33+
sev2: number
2934

30-
// The amount of Info severity level violations
31-
sev5: number
32-
}
35+
// The amount of Moderate severity level violations
36+
sev3: number
3337

34-
// Object containing the versions of core and engine modules that ran
35-
versions: JsonVersionOutput
38+
// The amount of Low severity level violations
39+
sev4: number
3640

37-
// Array of objects containing information about the violations detected
38-
violations: JsonViolationOutput[]
41+
// The amount of Info severity level violations
42+
sev5: number
3943
}
4044
export type JsonVersionOutput = {
4145
[coreOrEngineName: string]: string

0 commit comments

Comments
 (0)