@sun-asterisk/sunlint 1.3.30 → 1.3.32
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/cli-action-handler.js +32 -4
- package/package.json +1 -1
- package/rules/common/C006_function_naming/analyzer.js +289 -145
- package/rules/common/C067_no_hardcoded_config/symbol-based-analyzer.js +335 -3599
- package/rules/common/C067_no_hardcoded_config/symbol-based-analyzer.js.backup +3853 -0
- package/rules/security/S031_secure_session_cookies/analyzer.js +67 -112
- package/rules/security/S031_secure_session_cookies/regex-based-analyzer.js +0 -296
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const chalk = require('chalk');
|
|
9
9
|
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
10
11
|
const ConfigManager = require('./config-manager');
|
|
11
12
|
const RuleSelectionService = require('./rule-selection-service');
|
|
12
13
|
const AnalysisOrchestrator = require('./analysis-orchestrator');
|
|
@@ -121,9 +122,10 @@ class CliActionHandler {
|
|
|
121
122
|
enabledEngines: this.determineEnabledEngines(config),
|
|
122
123
|
aiConfig: config.ai || {},
|
|
123
124
|
eslintConfig: config.eslint || {},
|
|
124
|
-
heuristicConfig: {
|
|
125
|
+
heuristicConfig: {
|
|
125
126
|
...config.heuristic || {},
|
|
126
127
|
targetFiles: this.options.targetFiles, // Pass filtered files for semantic optimization
|
|
128
|
+
projectPath: this.getProjectPath(), // Pass target project path for semantic engine
|
|
127
129
|
maxSemanticFiles: this.options.maxSemanticFiles ? parseInt(this.options.maxSemanticFiles) : 1000,
|
|
128
130
|
verbose: this.options.verbose // Pass verbose for debugging
|
|
129
131
|
}
|
|
@@ -422,13 +424,39 @@ class CliActionHandler {
|
|
|
422
424
|
*/
|
|
423
425
|
async applyFileTargeting(config) {
|
|
424
426
|
// Handle both string and array input patterns
|
|
425
|
-
const inputPaths = Array.isArray(this.options.input)
|
|
426
|
-
? this.options.input
|
|
427
|
+
const inputPaths = Array.isArray(this.options.input)
|
|
428
|
+
? this.options.input
|
|
427
429
|
: [this.options.input];
|
|
428
|
-
|
|
430
|
+
|
|
429
431
|
return await this.fileTargetingService.getTargetFiles(inputPaths, config, this.options);
|
|
430
432
|
}
|
|
431
433
|
|
|
434
|
+
/**
|
|
435
|
+
* Get project path from input for semantic engine
|
|
436
|
+
* Returns the directory path of the target for proper file resolution
|
|
437
|
+
*/
|
|
438
|
+
getProjectPath() {
|
|
439
|
+
const input = Array.isArray(this.options.input)
|
|
440
|
+
? this.options.input[0]
|
|
441
|
+
: this.options.input;
|
|
442
|
+
|
|
443
|
+
if (!input) {
|
|
444
|
+
return process.cwd();
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
const absolutePath = path.isAbsolute(input) ? input : path.resolve(process.cwd(), input);
|
|
448
|
+
|
|
449
|
+
// If input is a file, return its directory; if directory, return as-is
|
|
450
|
+
try {
|
|
451
|
+
if (fs.existsSync(absolutePath) && fs.statSync(absolutePath).isFile()) {
|
|
452
|
+
return path.dirname(absolutePath);
|
|
453
|
+
}
|
|
454
|
+
return absolutePath;
|
|
455
|
+
} catch {
|
|
456
|
+
return absolutePath;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
432
460
|
/**
|
|
433
461
|
* Display analysis information
|
|
434
462
|
* Following Rule C006: Verb-noun naming
|
package/package.json
CHANGED