@sun-asterisk/sunlint 1.3.1 → 1.3.3
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 +85 -0
- package/CONTRIBUTING.md +210 -1691
- package/README.md +5 -3
- package/config/rule-analysis-strategies.js +17 -1
- package/config/rules/enhanced-rules-registry.json +506 -1161
- package/config/rules/rules-registry-generated.json +1 -1
- package/core/analysis-orchestrator.js +167 -42
- package/core/auto-performance-manager.js +243 -0
- package/core/cli-action-handler.js +9 -1
- package/core/cli-program.js +19 -5
- package/core/constants/defaults.js +56 -0
- package/core/enhanced-rules-registry.js +2 -1
- package/core/performance-optimizer.js +271 -0
- package/core/semantic-engine.js +15 -3
- package/core/semantic-rule-base.js +4 -2
- package/docs/FILE_LIMITS_COMPLETION_REPORT.md +151 -0
- package/docs/FILE_LIMITS_EXPLANATION.md +190 -0
- package/docs/PERFORMANCE.md +311 -0
- package/docs/PERFORMANCE_MIGRATION_GUIDE.md +368 -0
- package/docs/PERFORMANCE_OPTIMIZATION_PLAN.md +255 -0
- package/docs/QUICK_FILE_LIMITS.md +64 -0
- package/docs/SIMPLIFIED_USAGE_GUIDE.md +208 -0
- package/engines/heuristic-engine.js +247 -9
- 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 +11 -7
- package/package.json +2 -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/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/C035_error_logging_context/analyzer.js +3 -1
- package/rules/common/C048_no_bypass_architectural_layers/analyzer.js +180 -0
- package/rules/common/C048_no_bypass_architectural_layers/config.json +50 -0
- package/rules/common/C048_no_bypass_architectural_layers/symbol-based-analyzer.js +235 -0
- package/rules/common/C052_parsing_or_data_transformation/analyzer.js +180 -0
- package/rules/common/C052_parsing_or_data_transformation/config.json +50 -0
- package/rules/common/C052_parsing_or_data_transformation/symbol-based-analyzer.js +132 -0
- package/rules/index.js +7 -1
- 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/S017_use_parameterized_queries/README.md +128 -0
- package/rules/security/S017_use_parameterized_queries/analyzer.js +286 -0
- package/rules/security/S017_use_parameterized_queries/config.json +109 -0
- package/rules/security/S017_use_parameterized_queries/regex-based-analyzer.js +541 -0
- package/rules/security/S017_use_parameterized_queries/symbol-based-analyzer.js +777 -0
- package/rules/security/S031_secure_session_cookies/README.md +127 -0
- package/rules/security/S031_secure_session_cookies/analyzer.js +245 -0
- package/rules/security/S031_secure_session_cookies/config.json +86 -0
- package/rules/security/S031_secure_session_cookies/regex-based-analyzer.js +196 -0
- package/rules/security/S031_secure_session_cookies/symbol-based-analyzer.js +1084 -0
- package/rules/security/S032_httponly_session_cookies/FRAMEWORK_SUPPORT.md +209 -0
- package/rules/security/S032_httponly_session_cookies/README.md +184 -0
- package/rules/security/S032_httponly_session_cookies/analyzer.js +282 -0
- package/rules/security/S032_httponly_session_cookies/config.json +96 -0
- package/rules/security/S032_httponly_session_cookies/regex-based-analyzer.js +715 -0
- package/rules/security/S032_httponly_session_cookies/symbol-based-analyzer.js +1348 -0
- package/rules/security/S033_samesite_session_cookies/README.md +227 -0
- package/rules/security/S033_samesite_session_cookies/analyzer.js +242 -0
- package/rules/security/S033_samesite_session_cookies/config.json +87 -0
- package/rules/security/S033_samesite_session_cookies/regex-based-analyzer.js +703 -0
- package/rules/security/S033_samesite_session_cookies/symbol-based-analyzer.js +732 -0
- package/rules/security/S034_host_prefix_session_cookies/README.md +204 -0
- package/rules/security/S034_host_prefix_session_cookies/analyzer.js +290 -0
- package/rules/security/S034_host_prefix_session_cookies/config.json +62 -0
- package/rules/security/S034_host_prefix_session_cookies/regex-based-analyzer.js +478 -0
- package/rules/security/S034_host_prefix_session_cookies/symbol-based-analyzer.js +277 -0
- package/rules/security/S035_path_session_cookies/README.md +257 -0
- package/rules/security/S035_path_session_cookies/analyzer.js +316 -0
- package/rules/security/S035_path_session_cookies/config.json +99 -0
- package/rules/security/S035_path_session_cookies/regex-based-analyzer.js +724 -0
- package/rules/security/S035_path_session_cookies/symbol-based-analyzer.js +373 -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/batch-processing-demo.js +334 -0
- package/scripts/consolidate-config.js +116 -0
- package/scripts/performance-test.js +541 -0
- package/scripts/quick-performance-test.js +108 -0
- package/config/rules/S027-categories.json +0 -122
- package/config/rules/rules-registry.json +0 -777
- package/rules/common/C006_function_naming/smart-analyzer.js +0 -503
package/README.md
CHANGED
|
@@ -9,12 +9,13 @@ Sun Lint is a universal coding standards checker providing comprehensive code qu
|
|
|
9
9
|
### **✨ Key Features**
|
|
10
10
|
- ✅ **256+ Coding Rules**: Quality (161), Security (70), Performance (25)
|
|
11
11
|
- ✅ **Unified Architecture**: Same adapter pattern for CLI and VSCode extension
|
|
12
|
-
- ✅ **Multi-Engine Support**: Heuristic (244 rules) + ESLint (17 rules) + AI (256 rules)
|
|
12
|
+
- ✅ **Multi-Engine Support**: Heuristic v4.0 (244 rules) + ESLint (17 rules) + AI (256 rules)
|
|
13
|
+
- ✅ **Performance Optimized**: Auto file limits, memory management, GitHub Actions ready
|
|
13
14
|
- ✅ **Built-in AST Analysis**: JavaScript/TypeScript parsing out of the box
|
|
14
15
|
- ✅ **Git Integration**: `--changed-files`, `--staged-files`, `--pr-mode`
|
|
15
|
-
- ✅ **TypeScript Support**: Native TypeScript 5.8+ analysis
|
|
16
|
+
- ✅ **TypeScript Support**: Native TypeScript 5.8+ analysis with smart memory limits
|
|
16
17
|
- ✅ **Zero Config**: Works immediately after `npm install`
|
|
17
|
-
- ✅ **CI/CD Ready**: Baseline comparison, fail-on-new-violations
|
|
18
|
+
- ✅ **CI/CD Ready**: Baseline comparison, fail-on-new-violations, timeout protection
|
|
18
19
|
- ✅ **Advanced File Targeting**: Include/exclude patterns, language filtering
|
|
19
20
|
|
|
20
21
|
### **🏗️ Architecture**
|
|
@@ -376,6 +377,7 @@ sunlint --validate-config .sunlint.json
|
|
|
376
377
|
## 📚 **Documentation**
|
|
377
378
|
|
|
378
379
|
- **[Configuration Guide](./docs/CONFIGURATION.md)** - Complete config options with examples
|
|
380
|
+
- **[Performance & File Limits](./docs/FILE_LIMITS_EXPLANATION.md)** - Understanding `--max-files` vs `--max-semantic-files`
|
|
379
381
|
- [ESLint Integration Guide](./docs/ESLINT_INTEGRATION.md)
|
|
380
382
|
- [CI/CD Guide](./docs/CI-CD-GUIDE.md)
|
|
381
383
|
- [Architecture](./docs/ARCHITECTURE.md)
|
|
@@ -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'],
|
|
@@ -46,6 +51,11 @@ module.exports = {
|
|
|
46
51
|
methods: ['regex'],
|
|
47
52
|
accuracy: { regex: 95 }
|
|
48
53
|
},
|
|
54
|
+
'C002': {
|
|
55
|
+
reason: 'Duplicate code detection requires cross-file analysis',
|
|
56
|
+
methods: ['regex'],
|
|
57
|
+
accuracy: { regex: 85 }
|
|
58
|
+
},
|
|
49
59
|
'C043': {
|
|
50
60
|
reason: 'Console/print detection via simple patterns',
|
|
51
61
|
methods: ['regex'],
|
|
@@ -60,6 +70,12 @@ module.exports = {
|
|
|
60
70
|
|
|
61
71
|
// Rules that require hybrid approach
|
|
62
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
|
+
},
|
|
63
79
|
'C029': {
|
|
64
80
|
reason: 'Catch block analysis needs context + patterns',
|
|
65
81
|
methods: ['ast', 'regex', 'semantic'],
|
|
@@ -106,4 +122,4 @@ module.exports = {
|
|
|
106
122
|
strategy: 'progressive-enhancement'
|
|
107
123
|
}
|
|
108
124
|
}
|
|
109
|
-
};
|
|
125
|
+
};
|