@gulu9527/code-trust 0.3.0 → 0.3.2
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.
- package/README-CN.md +15 -0
- package/README.md +15 -0
- package/action.yml +5 -1
- package/dist/cli/index.js +605 -247
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +43 -0
- package/dist/index.js +583 -242
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,9 +14,30 @@ interface Issue {
|
|
|
14
14
|
suggestion?: string;
|
|
15
15
|
codeSnippet?: string;
|
|
16
16
|
}
|
|
17
|
+
type IssueLifecycleStatus = 'new' | 'existing';
|
|
17
18
|
interface ReportIssue extends Issue {
|
|
18
19
|
fingerprint: string;
|
|
19
20
|
fingerprintVersion: string;
|
|
21
|
+
lifecycle?: IssueLifecycleStatus;
|
|
22
|
+
}
|
|
23
|
+
interface FixedIssue {
|
|
24
|
+
ruleId: string;
|
|
25
|
+
severity: Severity;
|
|
26
|
+
category: RuleCategory;
|
|
27
|
+
file: string;
|
|
28
|
+
startLine: number;
|
|
29
|
+
endLine: number;
|
|
30
|
+
message: string;
|
|
31
|
+
fingerprint: string;
|
|
32
|
+
fingerprintVersion?: string;
|
|
33
|
+
}
|
|
34
|
+
interface LifecycleSummary {
|
|
35
|
+
newIssues: number;
|
|
36
|
+
existingIssues: number;
|
|
37
|
+
fixedIssues: number;
|
|
38
|
+
baselineUsed: boolean;
|
|
39
|
+
baselineCommit?: string;
|
|
40
|
+
baselineTimestamp?: string;
|
|
20
41
|
}
|
|
21
42
|
interface DimensionScore {
|
|
22
43
|
score: number;
|
|
@@ -70,6 +91,8 @@ interface TrustReport {
|
|
|
70
91
|
coverage: DimensionScore;
|
|
71
92
|
};
|
|
72
93
|
issues: ReportIssue[];
|
|
94
|
+
lifecycle?: LifecycleSummary;
|
|
95
|
+
fixedIssues?: FixedIssue[];
|
|
73
96
|
}
|
|
74
97
|
interface DiffFile {
|
|
75
98
|
filePath: string;
|
|
@@ -91,6 +114,7 @@ interface ScanOptions {
|
|
|
91
114
|
diff?: string;
|
|
92
115
|
files?: string[];
|
|
93
116
|
minScore?: number;
|
|
117
|
+
baseline?: string;
|
|
94
118
|
format?: 'terminal' | 'json' | 'html';
|
|
95
119
|
}
|
|
96
120
|
|
|
@@ -134,6 +158,11 @@ declare class ScanEngine {
|
|
|
134
158
|
constructor(config: CodeTrustConfig, workDir?: string);
|
|
135
159
|
scan(options: ScanOptions): Promise<TrustReport>;
|
|
136
160
|
private scanFile;
|
|
161
|
+
private createSkippedResult;
|
|
162
|
+
private createErrorResult;
|
|
163
|
+
private readFileContent;
|
|
164
|
+
private extractAddedLines;
|
|
165
|
+
private runStructureAnalysis;
|
|
137
166
|
private getScanCandidates;
|
|
138
167
|
private getScanMode;
|
|
139
168
|
private getDiffFiles;
|
|
@@ -142,6 +171,15 @@ declare class ScanEngine {
|
|
|
142
171
|
private isTsJsFile;
|
|
143
172
|
private attachFingerprints;
|
|
144
173
|
private normalizeRelativePath;
|
|
174
|
+
private loadBaseline;
|
|
175
|
+
private parseBaselineIssues;
|
|
176
|
+
private parseBaselineIssue;
|
|
177
|
+
private isValidBaselineIssue;
|
|
178
|
+
private attachLifecycle;
|
|
179
|
+
private getFixedIssues;
|
|
180
|
+
private buildLifecycleSummary;
|
|
181
|
+
private isSeverity;
|
|
182
|
+
private isRuleCategory;
|
|
145
183
|
private groupByDimension;
|
|
146
184
|
}
|
|
147
185
|
|
|
@@ -196,6 +234,11 @@ declare class DiffParser {
|
|
|
196
234
|
getStagedFiles(): Promise<DiffFile[]>;
|
|
197
235
|
getDiffFromRef(ref: string): Promise<DiffFile[]>;
|
|
198
236
|
getChangedFiles(): Promise<DiffFile[]>;
|
|
237
|
+
/**
|
|
238
|
+
* Merge two sets of diff files, deduplicating by file path.
|
|
239
|
+
* When a file appears in both, merge their hunks and combine stats.
|
|
240
|
+
*/
|
|
241
|
+
private mergeDiffFiles;
|
|
199
242
|
getLastCommitDiff(): Promise<DiffFile[]>;
|
|
200
243
|
getCurrentCommitHash(): Promise<string | undefined>;
|
|
201
244
|
getFileContent(filePath: string): Promise<string | undefined>;
|