@sun-asterisk/sunlint 1.3.0 → 1.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/CHANGELOG.md +115 -1
- package/CONTRIBUTING.md +249 -605
- package/README.md +3 -4
- package/config/ci-cd.json +54 -0
- package/config/development.json +56 -0
- package/config/large-project.json +143 -0
- package/config/presets/all.json +0 -1
- package/config/release.json +70 -0
- package/config/rule-analysis-strategies.js +38 -3
- package/config/rules/enhanced-rules-registry.json +474 -1179
- package/config/rules/rules-registry-generated.json +3 -3
- package/core/cli-action-handler.js +24 -30
- package/core/cli-program.js +11 -3
- package/core/config-merger.js +29 -2
- package/core/enhanced-rules-registry.js +3 -2
- package/core/semantic-engine.js +129 -19
- package/core/semantic-rule-base.js +4 -2
- package/core/unified-rule-registry.js +1 -1
- package/docs/COMMAND-EXAMPLES.md +134 -0
- package/docs/LARGE-PROJECT-GUIDE.md +324 -0
- package/engines/heuristic-engine.js +135 -16
- package/integrations/eslint/plugin/index.js +0 -2
- package/integrations/eslint/plugin/rules/common/c003-no-vague-abbreviations.js +59 -1
- package/integrations/eslint/plugin/rules/common/c006-function-name-verb-noun.js +26 -1
- package/integrations/eslint/plugin/rules/common/c030-use-custom-error-classes.js +54 -19
- package/origin-rules/common-en.md +19 -15
- package/package.json +1 -1
- package/rules/common/C002_no_duplicate_code/analyzer.js +334 -36
- package/rules/common/C003_no_vague_abbreviations/analyzer.js +220 -35
- package/rules/common/C006_function_naming/analyzer.js +29 -3
- package/rules/common/C010_limit_block_nesting/analyzer.js +181 -337
- package/rules/common/C010_limit_block_nesting/config.json +64 -0
- package/rules/common/C010_limit_block_nesting/regex-based-analyzer.js +379 -0
- package/rules/common/C010_limit_block_nesting/symbol-based-analyzer.js +231 -0
- package/rules/common/C013_no_dead_code/analyzer.js +75 -177
- package/rules/common/C013_no_dead_code/config.json +61 -0
- package/rules/common/C013_no_dead_code/regex-based-analyzer.js +345 -0
- package/rules/common/C013_no_dead_code/symbol-based-analyzer.js +640 -0
- package/rules/common/C014_dependency_injection/analyzer.js +48 -313
- package/rules/common/C014_dependency_injection/config.json +26 -0
- package/rules/common/C014_dependency_injection/symbol-based-analyzer.js +751 -0
- package/rules/common/C017_constructor_logic/analyzer.js +254 -17
- package/rules/common/C017_constructor_logic/semantic-analyzer.js +340 -0
- package/rules/common/C018_no_throw_generic_error/analyzer.js +232 -0
- package/rules/common/C018_no_throw_generic_error/config.json +50 -0
- package/rules/common/C018_no_throw_generic_error/regex-based-analyzer.js +387 -0
- package/rules/common/C018_no_throw_generic_error/symbol-based-analyzer.js +314 -0
- package/rules/common/C019_log_level_usage/analyzer.js +110 -317
- package/rules/common/C019_log_level_usage/pattern-analyzer.js +88 -0
- package/rules/common/C019_log_level_usage/system-log-analyzer.js +1267 -0
- package/rules/common/C023_no_duplicate_variable/analyzer.js +180 -0
- package/rules/common/C023_no_duplicate_variable/config.json +50 -0
- package/rules/common/C023_no_duplicate_variable/symbol-based-analyzer.js +158 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/analyzer.js +180 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/config.json +50 -0
- package/rules/common/C024_no_scatter_hardcoded_constants/symbol-based-analyzer.js +181 -0
- package/rules/common/C030_use_custom_error_classes/analyzer.js +200 -0
- package/rules/common/C033_separate_service_repository/README.md +78 -0
- package/rules/common/C033_separate_service_repository/analyzer.js +160 -0
- package/rules/common/C033_separate_service_repository/config.json +50 -0
- package/rules/common/C033_separate_service_repository/regex-based-analyzer.js +585 -0
- package/rules/common/C033_separate_service_repository/symbol-based-analyzer.js +368 -0
- package/rules/common/C035_error_logging_context/STRATEGY.md +99 -0
- package/rules/common/C035_error_logging_context/analyzer.js +232 -0
- package/rules/common/C035_error_logging_context/config.json +54 -0
- package/rules/common/C035_error_logging_context/regex-based-analyzer.js +299 -0
- package/rules/common/C035_error_logging_context/symbol-based-analyzer.js +454 -0
- package/rules/common/C040_centralized_validation/analyzer.js +165 -0
- package/rules/common/C040_centralized_validation/config.json +46 -0
- package/rules/common/C040_centralized_validation/regex-based-analyzer.js +243 -0
- package/rules/common/C040_centralized_validation/symbol-based-analyzer.js +416 -0
- package/rules/common/{C076_single_test_behavior → C072_single_test_behavior}/analyzer.js +6 -6
- package/rules/common/C076_explicit_function_types/README.md +30 -0
- package/rules/common/C076_explicit_function_types/analyzer.js +172 -0
- package/rules/common/C076_explicit_function_types/config.json +15 -0
- package/rules/common/C076_explicit_function_types/semantic-analyzer.js +341 -0
- package/rules/index.js +6 -1
- package/rules/parser/rule-parser.js +13 -2
- package/rules/security/S005_no_origin_auth/README.md +226 -0
- package/rules/security/S005_no_origin_auth/analyzer.js +184 -0
- package/rules/security/S005_no_origin_auth/ast-analyzer.js +406 -0
- package/rules/security/S005_no_origin_auth/config.json +85 -0
- package/rules/security/S006_no_plaintext_recovery_codes/README.md +139 -0
- package/rules/security/S006_no_plaintext_recovery_codes/analyzer.js +306 -0
- package/rules/security/S006_no_plaintext_recovery_codes/config.json +48 -0
- package/rules/security/S007_no_plaintext_otp/README.md +198 -0
- package/rules/security/S007_no_plaintext_otp/analyzer.js +406 -0
- package/rules/security/S007_no_plaintext_otp/config.json +79 -0
- package/rules/security/S007_no_plaintext_otp/semantic-analyzer.js +609 -0
- package/rules/security/S007_no_plaintext_otp/semantic-config.json +195 -0
- package/rules/security/S007_no_plaintext_otp/semantic-wrapper.js +280 -0
- package/rules/security/S009_no_insecure_encryption/README.md +158 -0
- package/rules/security/S009_no_insecure_encryption/analyzer.js +319 -0
- package/rules/security/S009_no_insecure_encryption/config.json +55 -0
- package/rules/security/S010_no_insecure_encryption/README.md +224 -0
- package/rules/security/S010_no_insecure_encryption/analyzer.js +493 -0
- package/rules/security/S010_no_insecure_encryption/config.json +48 -0
- package/rules/security/S016_no_sensitive_querystring/STRATEGY.md +149 -0
- package/rules/security/S016_no_sensitive_querystring/analyzer.js +276 -0
- package/rules/security/S016_no_sensitive_querystring/config.json +127 -0
- package/rules/security/S016_no_sensitive_querystring/regex-based-analyzer.js +258 -0
- package/rules/security/S016_no_sensitive_querystring/symbol-based-analyzer.js +495 -0
- package/rules/security/S027_no_hardcoded_secrets/analyzer.js +180 -366
- package/rules/security/S027_no_hardcoded_secrets/categories.json +153 -0
- package/rules/security/S027_no_hardcoded_secrets/categorized-analyzer.js +250 -0
- package/rules/security/S048_no_current_password_in_reset/README.md +222 -0
- package/rules/security/S048_no_current_password_in_reset/analyzer.js +366 -0
- package/rules/security/S048_no_current_password_in_reset/config.json +48 -0
- package/rules/security/S055_content_type_validation/README.md +176 -0
- package/rules/security/S055_content_type_validation/analyzer.js +312 -0
- package/rules/security/S055_content_type_validation/config.json +48 -0
- package/rules/utils/rule-helpers.js +140 -1
- package/scripts/consolidate-config.js +116 -0
- package/scripts/prepare-release.sh +1 -1
- package/config/rules/rules-registry.json +0 -765
- package/docs/ESLINT-INTEGRATION-STRATEGY.md +0 -392
- package/docs/FUTURE_PACKAGES.md +0 -83
- package/docs/HEURISTIC_VS_AI.md +0 -113
- package/docs/PRODUCTION_DEPLOYMENT_ANALYSIS.md +0 -112
- package/docs/PRODUCTION_SIZE_IMPACT.md +0 -183
- package/docs/RELEASE_GUIDE.md +0 -230
- package/docs/STANDARDIZED-CATEGORY-FILTERING.md +0 -156
- package/integrations/eslint/plugin/rules/common/c076-single-behavior-per-test.js +0 -254
- package/rules/common/C006_function_naming/smart-analyzer.js +0 -503
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ SunLint uses a unified adapter pattern ensuring consistency between CLI and VSCo
|
|
|
33
33
|
│ • Origin Rules (markdown) │
|
|
34
34
|
│ • Heuristic Engine (244 rules) │
|
|
35
35
|
│ • ESLint Engine (17 rules) │
|
|
36
|
-
│ •
|
|
36
|
+
│ • OpenAI Engine (256 rules) │
|
|
37
37
|
└───────────────────────────────────┘
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -166,13 +166,13 @@ sunlint --show-engines --rules=C010,R001,S005
|
|
|
166
166
|
# Use specific engine
|
|
167
167
|
sunlint --engine=heuristic --rules=C010,C020 --input=src
|
|
168
168
|
sunlint --engine=eslint --rules=R001,R006 --input=src
|
|
169
|
-
sunlint --engine=
|
|
169
|
+
sunlint --engine=openai --rules=C010,S001 --input=src
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
**Engine Stats:**
|
|
173
173
|
- **Heuristic Engine**: 244/256 rules (95.3%) - Fast, universal
|
|
174
174
|
- **ESLint Engine**: 17/256 rules (6.6%) - JavaScript/TypeScript focused
|
|
175
|
-
- **
|
|
175
|
+
- **OpenAI Engine**: 256/256 rules (100%) - Context-aware analysis
|
|
176
176
|
|
|
177
177
|
### **ESLint Integration**
|
|
178
178
|
Seamlessly integrate with existing ESLint configurations:
|
|
@@ -261,7 +261,6 @@ sunlint --all --only-source --input=src
|
|
|
261
261
|
| **C043** | No Console or Print | ✅ Stable |
|
|
262
262
|
| **C047** | No Duplicate Retry Logic | ✅ Stable |
|
|
263
263
|
| **C075** | Explicit Function Return Types | ✅ Stable |
|
|
264
|
-
| **C076** | Single Test Behavior | ✅ Stable |
|
|
265
264
|
| **T002-T021** | TypeScript-specific rules | ✅ Stable |
|
|
266
265
|
|
|
267
266
|
### **Security Rules** 🔒 (47 rules)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "CI/CD Optimized Configuration",
|
|
3
|
+
"description": "Fast analysis for CI/CD pipelines",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": 300,
|
|
7
|
+
"maxConcurrentRules": 3,
|
|
8
|
+
"timeoutMs": 30000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js"
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
"exclude": [
|
|
19
|
+
"**/*.test.*",
|
|
20
|
+
"**/*.d.ts",
|
|
21
|
+
"node_modules/**",
|
|
22
|
+
"dist/**",
|
|
23
|
+
"build/**"
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
"rules": {
|
|
27
|
+
"categories": {
|
|
28
|
+
"security": true,
|
|
29
|
+
"quality": true,
|
|
30
|
+
"logging": false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"output": {
|
|
35
|
+
"format": "github",
|
|
36
|
+
"console": true,
|
|
37
|
+
"summary": false
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
"engines": {
|
|
41
|
+
"semantic": {
|
|
42
|
+
"enabled": true,
|
|
43
|
+
"fileLimit": 300
|
|
44
|
+
},
|
|
45
|
+
"ai": {
|
|
46
|
+
"enabled": false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
"reporting": {
|
|
51
|
+
"exitOnError": true,
|
|
52
|
+
"showProgress": false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Development Configuration",
|
|
3
|
+
"description": "Fast feedback for daily development",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": 500,
|
|
7
|
+
"maxConcurrentRules": 4,
|
|
8
|
+
"timeoutMs": 15000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js",
|
|
16
|
+
"lib/**/*.ts"
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
"exclude": [
|
|
20
|
+
"**/*.test.*",
|
|
21
|
+
"**/*.spec.*",
|
|
22
|
+
"**/*.d.ts",
|
|
23
|
+
"node_modules/**",
|
|
24
|
+
"dist/**"
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
"rules": {
|
|
28
|
+
"C006": "error",
|
|
29
|
+
"C019": "error",
|
|
30
|
+
"C029": "error",
|
|
31
|
+
"S001": "error",
|
|
32
|
+
"S005": "error"
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
"output": {
|
|
36
|
+
"format": "summary",
|
|
37
|
+
"console": true,
|
|
38
|
+
"summary": true,
|
|
39
|
+
"verbose": false
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"engines": {
|
|
43
|
+
"semantic": {
|
|
44
|
+
"enabled": true,
|
|
45
|
+
"fileLimit": 500
|
|
46
|
+
},
|
|
47
|
+
"ai": {
|
|
48
|
+
"enabled": false
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
"git": {
|
|
53
|
+
"changedFiles": true,
|
|
54
|
+
"diffBase": "origin/main"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./sunlint-schema.json",
|
|
3
|
+
"name": "Large Project Configuration",
|
|
4
|
+
"description": "Optimized configuration for projects with 1000+ files",
|
|
5
|
+
|
|
6
|
+
"performance": {
|
|
7
|
+
"maxSemanticFiles": 1000,
|
|
8
|
+
"maxConcurrentRules": 5,
|
|
9
|
+
"timeoutMs": 60000,
|
|
10
|
+
"cacheEnabled": true,
|
|
11
|
+
"cacheLocation": ".sunlint-cache/"
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
"input": [
|
|
15
|
+
"src",
|
|
16
|
+
"lib",
|
|
17
|
+
"app",
|
|
18
|
+
"packages"
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
"include": [
|
|
22
|
+
"src/**/*.ts",
|
|
23
|
+
"src/**/*.js",
|
|
24
|
+
"lib/**/*.ts",
|
|
25
|
+
"app/**/*.ts",
|
|
26
|
+
"packages/*/src/**/*.ts"
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
"exclude": [
|
|
30
|
+
"node_modules/**",
|
|
31
|
+
"dist/**",
|
|
32
|
+
"build/**",
|
|
33
|
+
"coverage/**",
|
|
34
|
+
"**/*.test.*",
|
|
35
|
+
"**/*.spec.*",
|
|
36
|
+
"**/*.d.ts",
|
|
37
|
+
"**/*.generated.*",
|
|
38
|
+
"**/generated/**",
|
|
39
|
+
"**/*.min.*",
|
|
40
|
+
"**/*.bundle.*"
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
"rules": {
|
|
44
|
+
"enabled": [
|
|
45
|
+
"C006", "C019", "C029", "C047",
|
|
46
|
+
"S001", "S005", "S010"
|
|
47
|
+
],
|
|
48
|
+
"categories": {
|
|
49
|
+
"quality": true,
|
|
50
|
+
"security": true,
|
|
51
|
+
"performance": false,
|
|
52
|
+
"logging": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
"output": {
|
|
57
|
+
"format": "summary",
|
|
58
|
+
"console": true,
|
|
59
|
+
"summary": true,
|
|
60
|
+
"includeContext": true,
|
|
61
|
+
"showFixSuggestions": true,
|
|
62
|
+
"groupByFile": true,
|
|
63
|
+
"sortBy": "severity"
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
"engines": {
|
|
67
|
+
"semantic": {
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"fileLimit": 1000,
|
|
70
|
+
"enableCaching": true,
|
|
71
|
+
"crossFileAnalysis": true
|
|
72
|
+
},
|
|
73
|
+
"heuristic": {
|
|
74
|
+
"enabled": true,
|
|
75
|
+
"fastMode": false
|
|
76
|
+
},
|
|
77
|
+
"ai": {
|
|
78
|
+
"enabled": false,
|
|
79
|
+
"fallbackToPattern": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
"ci": {
|
|
84
|
+
"changedFiles": {
|
|
85
|
+
"maxSemanticFiles": 300,
|
|
86
|
+
"format": "github",
|
|
87
|
+
"failOnError": true
|
|
88
|
+
},
|
|
89
|
+
"fullScan": {
|
|
90
|
+
"maxSemanticFiles": 1000,
|
|
91
|
+
"format": "json",
|
|
92
|
+
"output": "sunlint-report.json"
|
|
93
|
+
},
|
|
94
|
+
"nightly": {
|
|
95
|
+
"maxSemanticFiles": 2000,
|
|
96
|
+
"format": "detailed",
|
|
97
|
+
"output": "nightly-report.json"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
"overrides": [
|
|
102
|
+
{
|
|
103
|
+
"files": ["src/critical/**/*.ts"],
|
|
104
|
+
"performance": {
|
|
105
|
+
"maxSemanticFiles": 2000
|
|
106
|
+
},
|
|
107
|
+
"rules": {
|
|
108
|
+
"enabled": "all"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"files": ["**/*.test.*", "**/*.spec.*"],
|
|
113
|
+
"performance": {
|
|
114
|
+
"maxSemanticFiles": 500
|
|
115
|
+
},
|
|
116
|
+
"rules": {
|
|
117
|
+
"categories": {
|
|
118
|
+
"testing": true,
|
|
119
|
+
"security": false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"files": ["packages/*/src/**"],
|
|
125
|
+
"performance": {
|
|
126
|
+
"maxSemanticFiles": 1500
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
|
|
131
|
+
"reporting": {
|
|
132
|
+
"baseline": {
|
|
133
|
+
"enabled": true,
|
|
134
|
+
"file": "baseline.json",
|
|
135
|
+
"updateOnClean": true
|
|
136
|
+
},
|
|
137
|
+
"trends": {
|
|
138
|
+
"enabled": true,
|
|
139
|
+
"historyFile": "trends.json",
|
|
140
|
+
"trackMetrics": ["violations", "files", "performance"]
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
package/config/presets/all.json
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Release Validation Configuration",
|
|
3
|
+
"description": "Comprehensive analysis for release validation",
|
|
4
|
+
|
|
5
|
+
"performance": {
|
|
6
|
+
"maxSemanticFiles": -1,
|
|
7
|
+
"maxConcurrentRules": 8,
|
|
8
|
+
"timeoutMs": 300000
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
"input": ["."],
|
|
12
|
+
|
|
13
|
+
"include": [
|
|
14
|
+
"src/**/*.ts",
|
|
15
|
+
"src/**/*.js",
|
|
16
|
+
"lib/**/*.ts",
|
|
17
|
+
"app/**/*.ts",
|
|
18
|
+
"packages/*/src/**/*.ts"
|
|
19
|
+
],
|
|
20
|
+
|
|
21
|
+
"exclude": [
|
|
22
|
+
"node_modules/**",
|
|
23
|
+
"dist/**",
|
|
24
|
+
"build/**",
|
|
25
|
+
"coverage/**",
|
|
26
|
+
"**/*.min.*",
|
|
27
|
+
"**/*.bundle.*"
|
|
28
|
+
],
|
|
29
|
+
|
|
30
|
+
"rules": {
|
|
31
|
+
"enabled": "all"
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
"output": {
|
|
35
|
+
"format": "detailed",
|
|
36
|
+
"console": true,
|
|
37
|
+
"summary": true,
|
|
38
|
+
"includeContext": true,
|
|
39
|
+
"showFixSuggestions": true,
|
|
40
|
+
"output": "release-validation-report.json"
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
"engines": {
|
|
44
|
+
"semantic": {
|
|
45
|
+
"enabled": true,
|
|
46
|
+
"fileLimit": -1,
|
|
47
|
+
"enableCaching": true,
|
|
48
|
+
"crossFileAnalysis": true
|
|
49
|
+
},
|
|
50
|
+
"ai": {
|
|
51
|
+
"enabled": true,
|
|
52
|
+
"provider": "openai",
|
|
53
|
+
"model": "gpt-4o-mini"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
"reporting": {
|
|
58
|
+
"baseline": {
|
|
59
|
+
"enabled": true,
|
|
60
|
+
"file": "release-baseline.json",
|
|
61
|
+
"compareWithPrevious": true
|
|
62
|
+
},
|
|
63
|
+
"trends": {
|
|
64
|
+
"enabled": true,
|
|
65
|
+
"historyFile": "release-trends.json"
|
|
66
|
+
},
|
|
67
|
+
"failOnNewViolations": true,
|
|
68
|
+
"exitOnError": true
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
module.exports = {
|
|
7
7
|
// Rules that benefit significantly from AST analysis
|
|
8
8
|
astPreferred: {
|
|
9
|
+
'C003': {
|
|
10
|
+
reason: 'Variable naming requires context awareness (types, scopes, conventions)',
|
|
11
|
+
methods: ['ast', 'regex'],
|
|
12
|
+
accuracy: { ast: 95, regex: 75 }
|
|
13
|
+
},
|
|
9
14
|
'C010': {
|
|
10
15
|
reason: 'Block nesting requires precise scope tracking',
|
|
11
16
|
methods: ['ast', 'regex'],
|
|
@@ -22,9 +27,10 @@ module.exports = {
|
|
|
22
27
|
accuracy: { ast: 95, regex: 85 }
|
|
23
28
|
},
|
|
24
29
|
'C017': {
|
|
25
|
-
reason: 'Constructor logic analysis needs
|
|
26
|
-
methods: ['ast', 'regex'],
|
|
27
|
-
accuracy: { ast:
|
|
30
|
+
reason: 'Constructor logic analysis needs semantic context - Phase 2 with symbol-based analysis',
|
|
31
|
+
methods: ['semantic', 'ast', 'regex'],
|
|
32
|
+
accuracy: { semantic: 95, ast: 85, regex: 70 },
|
|
33
|
+
strategy: 'semantic-primary'
|
|
28
34
|
},
|
|
29
35
|
'S015': {
|
|
30
36
|
reason: 'TLS certificate validation requires AST context analysis',
|
|
@@ -45,6 +51,11 @@ module.exports = {
|
|
|
45
51
|
methods: ['regex'],
|
|
46
52
|
accuracy: { regex: 95 }
|
|
47
53
|
},
|
|
54
|
+
'C002': {
|
|
55
|
+
reason: 'Duplicate code detection requires cross-file analysis',
|
|
56
|
+
methods: ['regex'],
|
|
57
|
+
accuracy: { regex: 85 }
|
|
58
|
+
},
|
|
48
59
|
'C043': {
|
|
49
60
|
reason: 'Console/print detection via simple patterns',
|
|
50
61
|
methods: ['regex'],
|
|
@@ -59,12 +70,36 @@ module.exports = {
|
|
|
59
70
|
|
|
60
71
|
// Rules that require hybrid approach
|
|
61
72
|
hybridOptimal: {
|
|
73
|
+
'C018': {
|
|
74
|
+
reason: 'Do not throw generic errors',
|
|
75
|
+
methods: ['semantic', 'regex'],
|
|
76
|
+
strategy: 'semantic-primary-regex-fallback',
|
|
77
|
+
accuracy: { semantic: 90, regex: 70, combined: 95 }
|
|
78
|
+
},
|
|
62
79
|
'C029': {
|
|
63
80
|
reason: 'Catch block analysis needs context + patterns',
|
|
64
81
|
methods: ['ast', 'regex', 'semantic'],
|
|
65
82
|
strategy: 'ast-primary-regex-fallback',
|
|
66
83
|
accuracy: { ast: 90, regex: 75, combined: 95 }
|
|
67
84
|
},
|
|
85
|
+
'C035': {
|
|
86
|
+
reason: 'Error logging context requires symbol-based + regex analysis',
|
|
87
|
+
methods: ['semantic', 'regex'],
|
|
88
|
+
strategy: 'semantic-primary-regex-fallback',
|
|
89
|
+
accuracy: { semantic: 90, regex: 70, combined: 95 }
|
|
90
|
+
},
|
|
91
|
+
'C040': {
|
|
92
|
+
reason: 'Validation centralization requires project-wide symbol analysis + data flow tracking',
|
|
93
|
+
methods: ['semantic', 'regex'],
|
|
94
|
+
strategy: 'semantic-primary-regex-fallback',
|
|
95
|
+
accuracy: { semantic: 95, regex: 75, combined: 97 }
|
|
96
|
+
},
|
|
97
|
+
'C076': {
|
|
98
|
+
reason: 'Public API type enforcement requires symbol-based analysis for export boundaries',
|
|
99
|
+
methods: ['semantic'],
|
|
100
|
+
strategy: 'semantic-primary',
|
|
101
|
+
accuracy: { semantic: 95 }
|
|
102
|
+
},
|
|
68
103
|
'C041': {
|
|
69
104
|
reason: 'Hardcoded secrets need AST literal analysis like ESLint',
|
|
70
105
|
methods: ['ast', 'regex'],
|