@sun-asterisk/sunlint 1.3.15 → 1.3.16
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/core/output-service.js +19 -1
- package/core/summary-report-service.js +21 -3
- package/package.json +1 -1
package/core/output-service.js
CHANGED
|
@@ -14,6 +14,24 @@ class OutputService {
|
|
|
14
14
|
this.scoringService = new ScoringService();
|
|
15
15
|
this.summaryReportService = new SummaryReportService();
|
|
16
16
|
this.uploadService = new UploadService();
|
|
17
|
+
|
|
18
|
+
// Load version from package.json
|
|
19
|
+
this.version = this._loadVersion();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Load version from package.json
|
|
24
|
+
* @returns {string} Package version
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
_loadVersion() {
|
|
28
|
+
try {
|
|
29
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
30
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
31
|
+
return packageJson.version || '1.3.16';
|
|
32
|
+
} catch (error) {
|
|
33
|
+
return '1.3.16'; // Fallback version
|
|
34
|
+
}
|
|
17
35
|
}
|
|
18
36
|
|
|
19
37
|
async outputResults(results, options, metadata = {}) {
|
|
@@ -111,7 +129,7 @@ class OutputService {
|
|
|
111
129
|
cwd: process.cwd(),
|
|
112
130
|
filesAnalyzed: totalFiles,
|
|
113
131
|
duration: metadata.duration,
|
|
114
|
-
version: metadata.version ||
|
|
132
|
+
version: metadata.version || this.version
|
|
115
133
|
}
|
|
116
134
|
);
|
|
117
135
|
|
|
@@ -9,7 +9,25 @@ const path = require('path');
|
|
|
9
9
|
const { execSync } = require('child_process');
|
|
10
10
|
|
|
11
11
|
class SummaryReportService {
|
|
12
|
-
constructor() {
|
|
12
|
+
constructor() {
|
|
13
|
+
// Load version from package.json
|
|
14
|
+
this.version = this._loadVersion();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Load version from package.json
|
|
19
|
+
* @returns {string} Package version
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
_loadVersion() {
|
|
23
|
+
try {
|
|
24
|
+
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
|
25
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
26
|
+
return packageJson.version || '1.3.16';
|
|
27
|
+
} catch (error) {
|
|
28
|
+
return '1.3.16'; // Fallback version
|
|
29
|
+
}
|
|
30
|
+
}
|
|
13
31
|
|
|
14
32
|
/**
|
|
15
33
|
* Get Git repository information
|
|
@@ -214,7 +232,7 @@ class SummaryReportService {
|
|
|
214
232
|
info_count: 0, // Reserved for future use
|
|
215
233
|
lines_of_code: scoringSummary.metrics.linesOfCode,
|
|
216
234
|
files_analyzed: options.filesAnalyzed || 0,
|
|
217
|
-
sunlint_version: options.version ||
|
|
235
|
+
sunlint_version: options.version || this.version,
|
|
218
236
|
analysis_duration_ms: options.duration || 0,
|
|
219
237
|
violations: violationsSummary,
|
|
220
238
|
|
|
@@ -222,7 +240,7 @@ class SummaryReportService {
|
|
|
222
240
|
metadata: {
|
|
223
241
|
generated_at: new Date().toISOString(),
|
|
224
242
|
tool: 'SunLint',
|
|
225
|
-
version: options.version ||
|
|
243
|
+
version: options.version || this.version,
|
|
226
244
|
analysis_duration_ms: options.duration || 0
|
|
227
245
|
},
|
|
228
246
|
quality: {
|
package/package.json
CHANGED