@sun-asterisk/sunlint 1.2.2 → 1.3.1
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 +107 -1
- package/CONTRIBUTING.md +1654 -66
- package/README.md +19 -6
- package/config/ci-cd.json +54 -0
- package/config/development.json +56 -0
- package/config/engines/engines-enhanced.json +86 -0
- package/config/engines/semantic-config.json +114 -0
- package/config/eslint-rule-mapping.json +50 -38
- 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 +23 -4
- package/config/rules/S027-categories.json +122 -0
- package/config/rules/enhanced-rules-registry.json +2564 -0
- package/config/rules/rules-registry-generated.json +785 -837
- package/config/rules/rules-registry.json +13 -1
- package/core/adapters/sunlint-rule-adapter.js +25 -30
- package/core/analysis-orchestrator.js +42 -2
- package/core/categories.js +52 -0
- package/core/category-constants.js +39 -0
- package/core/cli-action-handler.js +53 -32
- package/core/cli-program.js +11 -3
- package/core/config-manager.js +111 -0
- package/core/config-merger.js +88 -0
- package/core/constants/categories.js +168 -0
- package/core/constants/defaults.js +165 -0
- package/core/constants/engines.js +185 -0
- package/core/constants/index.js +30 -0
- package/core/constants/rules.js +215 -0
- package/core/enhanced-rules-registry.js +3 -3
- package/core/file-targeting-service.js +128 -7
- package/core/interfaces/rule-plugin.interface.js +207 -0
- package/core/plugin-manager.js +448 -0
- package/core/rule-selection-service.js +42 -15
- package/core/semantic-engine.js +658 -0
- package/core/semantic-rule-base.js +433 -0
- package/core/unified-rule-registry.js +484 -0
- package/docs/COMMAND-EXAMPLES.md +134 -0
- package/docs/CONSTANTS-ARCHITECTURE.md +288 -0
- package/docs/LARGE-PROJECT-GUIDE.md +324 -0
- package/engines/core/base-engine.js +249 -0
- package/engines/engine-factory.js +275 -0
- package/engines/eslint-engine.js +171 -19
- package/engines/heuristic-engine.js +569 -78
- package/integrations/eslint/plugin/index.js +26 -28
- package/origin-rules/common-en.md +8 -8
- package/package.json +10 -6
- package/rules/common/C003_no_vague_abbreviations/analyzer.js +1 -1
- package/rules/common/C017_constructor_logic/analyzer.js +254 -17
- package/rules/common/C017_constructor_logic/semantic-analyzer.js +340 -0
- package/rules/common/C029_catch_block_logging/analyzer.js +17 -5
- 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 +230 -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/C047_no_duplicate_retry_logic/c047-semantic-rule.js +278 -0
- package/rules/common/C047_no_duplicate_retry_logic/symbol-analyzer-enhanced.js +968 -0
- package/rules/common/C047_no_duplicate_retry_logic/symbol-config.json +71 -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 +8 -0
- 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/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/scripts/category-manager.js +150 -0
- package/scripts/generate-rules-registry.js +88 -0
- package/scripts/migrate-rule-registry.js +157 -0
- package/scripts/prepare-release.sh +1 -1
- package/scripts/validate-system.js +48 -0
- package/.sunlint.json +0 -35
- package/config/README.md +0 -88
- package/config/engines/eslint-rule-mapping.json +0 -74
- package/config/schemas/sunlint-schema.json +0 -0
- package/config/testing/test-s005-working.ts +0 -22
- package/core/multi-rule-runner.js +0 -0
- 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/engines/tree-sitter-parser.js +0 -0
- package/engines/universal-ast-engine.js +0 -0
- package/integrations/eslint/plugin/rules/common/c076-single-behavior-per-test.js +0 -254
- package/rules/common/C029_catch_block_logging/analyzer-backup.js +0 -426
- package/rules/common/C029_catch_block_logging/analyzer-fixed.js +0 -130
- package/rules/common/C029_catch_block_logging/analyzer-multi-tech.js +0 -487
- package/rules/common/C029_catch_block_logging/analyzer-simple.js +0 -110
- package/rules/common/C029_catch_block_logging/ast-analyzer-backup.js +0 -441
- package/rules/common/C029_catch_block_logging/ast-analyzer-new.js +0 -127
- package/rules/common/C029_catch_block_logging/ast-analyzer.js +0 -133
- package/rules/common/C029_catch_block_logging/cfg-analyzer.js +0 -408
- package/rules/common/C029_catch_block_logging/dataflow-analyzer.js +0 -454
- package/rules/common/C029_catch_block_logging/multi-language-ast-engine.js +0 -700
- package/rules/common/C029_catch_block_logging/pattern-learning-analyzer.js +0 -568
- package/rules/common/C029_catch_block_logging/semantic-analyzer.js +0 -459
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
# 📦 SunLint Production Size Impact Analysis
|
|
2
|
-
|
|
3
|
-
## Tóm tắt cho Leadership
|
|
4
|
-
|
|
5
|
-
**KẾT LUẬN: SunLint KHÔNG làm tăng size production khi sử dụng đúng cách.**
|
|
6
|
-
|
|
7
|
-
## Chi tiết phân tích
|
|
8
|
-
|
|
9
|
-
### 1. Package Size của SunLint
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
SunLint package size: 241.6 kB
|
|
13
|
-
SunLint unpacked size: 1.1 MB
|
|
14
|
-
Total files: 214
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### 2. Test Production Impact
|
|
18
|
-
|
|
19
|
-
Chúng tôi đã tạo một project test để kiểm tra impact thực tế:
|
|
20
|
-
|
|
21
|
-
| Giai đoạn | Size | Ghi chú |
|
|
22
|
-
|-----------|------|---------|
|
|
23
|
-
| Project ban đầu | 8.0K | Chỉ có package.json và .gitignore |
|
|
24
|
-
| Sau khi cài SunLint (devDependency) | 88M | Bao gồm tất cả devDependencies |
|
|
25
|
-
| Production bundle (dist/) | 4.0K | Code production thực tế |
|
|
26
|
-
| Sau npm prune --production | 156K | Đã xóa tất cả devDependencies |
|
|
27
|
-
|
|
28
|
-
### 3. Khuyến nghị sử dụng trong Production
|
|
29
|
-
|
|
30
|
-
#### ✅ ĐÚNG CÁCH (Production-friendly):
|
|
31
|
-
|
|
32
|
-
```json
|
|
33
|
-
{
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@sun-asterisk/sunlint": "^1.1.4"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**Lợi ích:**
|
|
41
|
-
- ✅ Không ảnh hưởng size production bundle
|
|
42
|
-
- ✅ Chỉ cài khi development (`npm install`)
|
|
43
|
-
- ✅ Tự động loại trừ khỏi production (`npm prune --production`)
|
|
44
|
-
- ✅ CI/CD có thể dùng để check code quality
|
|
45
|
-
|
|
46
|
-
#### ❌ SAI CÁCH (Không khuyến nghị):
|
|
47
|
-
|
|
48
|
-
```json
|
|
49
|
-
{
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"@sun-asterisk/sunlint": "^1.1.4"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**Vấn đề:**
|
|
57
|
-
- ❌ Tăng 1.1MB cho production bundle
|
|
58
|
-
- ❌ Không cần thiết cho runtime
|
|
59
|
-
- ❌ Làm chậm deployment
|
|
60
|
-
|
|
61
|
-
### 4. Deployment Strategies
|
|
62
|
-
|
|
63
|
-
#### Option 1: Development Only (Khuyến nghị)
|
|
64
|
-
```bash
|
|
65
|
-
# Development
|
|
66
|
-
npm install
|
|
67
|
-
|
|
68
|
-
# Production build
|
|
69
|
-
npm run build
|
|
70
|
-
npm prune --production
|
|
71
|
-
# → SunLint sẽ bị xóa hoàn toàn
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
#### Option 2: CI/CD Pipeline
|
|
75
|
-
```yaml
|
|
76
|
-
# .github/workflows/ci.yml
|
|
77
|
-
- name: Install deps
|
|
78
|
-
run: npm ci
|
|
79
|
-
- name: Run SunLint
|
|
80
|
-
run: npx sunlint --quality --input=src
|
|
81
|
-
- name: Build production
|
|
82
|
-
run: npm run build
|
|
83
|
-
- name: Remove dev deps
|
|
84
|
-
run: npm prune --production
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
#### Option 3: Docker Multi-stage
|
|
88
|
-
```dockerfile
|
|
89
|
-
# Development stage với SunLint
|
|
90
|
-
FROM node:18 as dev
|
|
91
|
-
COPY package*.json ./
|
|
92
|
-
RUN npm ci
|
|
93
|
-
COPY . .
|
|
94
|
-
RUN npx sunlint --all --input=src
|
|
95
|
-
|
|
96
|
-
# Production stage KHÔNG có SunLint
|
|
97
|
-
FROM node:18-alpine as prod
|
|
98
|
-
COPY package*.json ./
|
|
99
|
-
RUN npm ci --only=production
|
|
100
|
-
COPY dist/ ./dist/
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### 5. So sánh với các tools khác
|
|
104
|
-
|
|
105
|
-
| Tool | Package Size | Production Impact | Use Case |
|
|
106
|
-
|------|-------------|-------------------|-----------|
|
|
107
|
-
| ESLint | ~500KB | ❌ Nếu để dependencies | Development only |
|
|
108
|
-
| Prettier | ~200KB | ❌ Nếu để dependencies | Development only |
|
|
109
|
-
| **SunLint** | **241KB** | **✅ KHÔNG (devDep)** | **Development + CI/CD** |
|
|
110
|
-
| TypeScript | ~60MB | ❌ Nếu để dependencies | Development only |
|
|
111
|
-
|
|
112
|
-
### 6. Best Practices cho Teams
|
|
113
|
-
|
|
114
|
-
#### Developers:
|
|
115
|
-
```bash
|
|
116
|
-
# Local development
|
|
117
|
-
npm install # Cài tất cả deps (bao gồm SunLint)
|
|
118
|
-
npx sunlint --quality --input=src
|
|
119
|
-
|
|
120
|
-
# Pre-commit hook
|
|
121
|
-
npx sunlint --changed-files
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
#### CI/CD:
|
|
125
|
-
```bash
|
|
126
|
-
# Build pipeline
|
|
127
|
-
npm ci # Cài tất cả deps
|
|
128
|
-
npx sunlint --all --input=src # Quality check
|
|
129
|
-
npm run build # Build production
|
|
130
|
-
npm prune --production # Xóa devDeps
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### Production:
|
|
134
|
-
```bash
|
|
135
|
-
# Server deployment
|
|
136
|
-
npm ci --only=production # Chỉ cài production deps
|
|
137
|
-
# → SunLint sẽ KHÔNG được cài
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### 7. Monitoring & Verification
|
|
141
|
-
|
|
142
|
-
#### Verify production size:
|
|
143
|
-
```bash
|
|
144
|
-
# Trước deploy
|
|
145
|
-
du -sh node_modules
|
|
146
|
-
du -sh dist/
|
|
147
|
-
|
|
148
|
-
# Kiểm tra không có SunLint
|
|
149
|
-
ls node_modules | grep sunlint # Không có kết quả = OK
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
#### Bundle size monitoring:
|
|
153
|
-
```bash
|
|
154
|
-
# Add to package.json
|
|
155
|
-
{
|
|
156
|
-
"scripts": {
|
|
157
|
-
"analyze-bundle": "du -sh dist/ && echo 'Production bundle size'",
|
|
158
|
-
"verify-prod": "npm ls --production --depth=0"
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Kết luận
|
|
164
|
-
|
|
165
|
-
### ✅ AN TOÀN cho Production:
|
|
166
|
-
- SunLint được thiết kế như devDependency
|
|
167
|
-
- Không ảnh hưởng size production bundle khi sử dụng đúng
|
|
168
|
-
- Có thể tích hợp vào CI/CD mà không ảnh hưởng deployment
|
|
169
|
-
|
|
170
|
-
### 📊 Số liệu cụ thể:
|
|
171
|
-
- **Development**: +88MB (chỉ khi dev)
|
|
172
|
-
- **Production**: +0KB (khi dùng đúng cách)
|
|
173
|
-
- **CI/CD**: Impact chỉ ở build time, không ở runtime
|
|
174
|
-
|
|
175
|
-
### 🚀 Khuyến nghị:
|
|
176
|
-
1. **Luôn cài như devDependency**
|
|
177
|
-
2. **Sử dụng trong CI/CD pipeline**
|
|
178
|
-
3. **npm prune --production trước deploy**
|
|
179
|
-
4. **Monitor bundle size định kỳ**
|
|
180
|
-
|
|
181
|
-
---
|
|
182
|
-
|
|
183
|
-
*Tài liệu này được cập nhật cho SunLint v1.1.4 - July 2025*
|
package/docs/RELEASE_GUIDE.md
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
# 🚀 SunLint v1.0.5 Release Guide
|
|
2
|
-
|
|
3
|
-
## 📦 **Dual Release Strategy**
|
|
4
|
-
|
|
5
|
-
SunLint v1.0.5 supports **two deployment methods** to meet different enterprise needs:
|
|
6
|
-
|
|
7
|
-
### **1. GitHub Package Registry (Private/Enterprise)**
|
|
8
|
-
- **Purpose**: Private enterprise distribution
|
|
9
|
-
- **Benefits**: Free private packages, organization control
|
|
10
|
-
- **Target**: Internal teams, enterprise customers
|
|
11
|
-
|
|
12
|
-
### **2. Global Tarball Release (Public)**
|
|
13
|
-
- **Purpose**: Public distribution via GitHub Releases
|
|
14
|
-
- **Benefits**: No NPM Registry fees, direct download
|
|
15
|
-
- **Target**: Open source community, public usage
|
|
16
|
-
|
|
17
|
-
## 🔧 **Release Process**
|
|
18
|
-
|
|
19
|
-
### **Automated Release (Recommended)**
|
|
20
|
-
|
|
21
|
-
1. **Trigger GitHub Action**:
|
|
22
|
-
- Go to GitHub Actions → "Release SunLint" workflow
|
|
23
|
-
- Click "Run workflow"
|
|
24
|
-
- Select parameters:
|
|
25
|
-
- **Version**: `1.0.5`
|
|
26
|
-
- **Release Type**: `both` (GitHub Package + Tarball)
|
|
27
|
-
|
|
28
|
-
2. **Automated Steps**:
|
|
29
|
-
- ✅ Run tests
|
|
30
|
-
- ✅ Update version numbers
|
|
31
|
-
- ✅ Build package tarball
|
|
32
|
-
- ✅ Publish to GitHub Package Registry
|
|
33
|
-
- ✅ Create GitHub Release with tarball
|
|
34
|
-
- ✅ Generate installation documentation
|
|
35
|
-
|
|
36
|
-
### **Manual Release (Alternative)**
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
# 1. Prepare release
|
|
40
|
-
cd coding-quality/extensions/sunlint
|
|
41
|
-
npm test
|
|
42
|
-
npm run clean
|
|
43
|
-
|
|
44
|
-
# 2. Update version
|
|
45
|
-
npm version 1.0.5 --no-git-tag-version
|
|
46
|
-
|
|
47
|
-
# 3. GitHub Package Registry
|
|
48
|
-
cp package-github.json package.json
|
|
49
|
-
npm publish --registry=https://npm.pkg.github.com
|
|
50
|
-
|
|
51
|
-
# 4. Global tarball
|
|
52
|
-
npm pack
|
|
53
|
-
mv *.tgz sunlint-1.0.5.tgz
|
|
54
|
-
|
|
55
|
-
# 5. Create GitHub release (manual upload)
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## 📖 **Installation Methods**
|
|
59
|
-
|
|
60
|
-
### **Method 1: GitHub Package Registry**
|
|
61
|
-
|
|
62
|
-
**Setup (one-time)**:
|
|
63
|
-
```bash
|
|
64
|
-
# Configure GitHub Package Registry
|
|
65
|
-
echo "@sun-asterisk:registry=https://npm.pkg.github.com" >> ~/.npmrc
|
|
66
|
-
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> ~/.npmrc
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Install**:
|
|
70
|
-
```bash
|
|
71
|
-
# Global installation
|
|
72
|
-
npm install -g @sun-asterisk/sunlint
|
|
73
|
-
|
|
74
|
-
# Project installation
|
|
75
|
-
npm install --save-dev @sun-asterisk/sunlint
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### **Method 2: Direct Tarball**
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
# Global installation from release
|
|
82
|
-
npm install -g https://github.com/sun-asterisk/engineer-excellence/releases/download/sunlint-v1.0.5/sunlint-1.0.5.tgz
|
|
83
|
-
|
|
84
|
-
# Project installation
|
|
85
|
-
npm install --save-dev https://github.com/sun-asterisk/engineer-excellence/releases/download/sunlint-v1.0.5/sunlint-1.0.5.tgz
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### **Method 3: Setup Script**
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
# One-line setup for GitHub Package Registry
|
|
92
|
-
curl -fsSL https://raw.githubusercontent.com/sun-asterisk/engineer-excellence/main/coding-quality/extensions/sunlint/scripts/setup-github-registry.sh | GITHUB_TOKEN=your_token bash
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## 🎯 **Team Integration Examples**
|
|
96
|
-
|
|
97
|
-
### **Enterprise Team (GitHub Package Registry)**
|
|
98
|
-
|
|
99
|
-
```json
|
|
100
|
-
{
|
|
101
|
-
"name": "my-enterprise-project",
|
|
102
|
-
"scripts": {
|
|
103
|
-
"lint": "sunlint --all --input=src",
|
|
104
|
-
"lint:changed": "sunlint --all --changed-files",
|
|
105
|
-
"lint:eslint": "sunlint --all --eslint-integration --input=src",
|
|
106
|
-
"ci:lint": "sunlint --all --changed-files --fail-on-new-violations"
|
|
107
|
-
},
|
|
108
|
-
"devDependencies": {
|
|
109
|
-
"@sun-asterisk/sunlint": "^1.0.5"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**.npmrc** (project-level):
|
|
115
|
-
```
|
|
116
|
-
@sun-asterisk:registry=https://npm.pkg.github.com
|
|
117
|
-
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### **Open Source Project (Direct Tarball)**
|
|
121
|
-
|
|
122
|
-
```json
|
|
123
|
-
{
|
|
124
|
-
"name": "my-open-source-project",
|
|
125
|
-
"scripts": {
|
|
126
|
-
"lint": "sunlint --all --input=src",
|
|
127
|
-
"lint:eslint": "sunlint --all --eslint-integration --input=src"
|
|
128
|
-
},
|
|
129
|
-
"devDependencies": {
|
|
130
|
-
"@sun-asterisk/sunlint": "https://github.com/sun-asterisk/engineer-excellence/releases/download/sunlint-v1.0.5/sunlint-1.0.5.tgz"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## 🚢 **CI/CD Integration**
|
|
136
|
-
|
|
137
|
-
### **GitHub Actions with GitHub Package Registry**
|
|
138
|
-
|
|
139
|
-
```yaml
|
|
140
|
-
name: Code Quality
|
|
141
|
-
on: [pull_request]
|
|
142
|
-
|
|
143
|
-
jobs:
|
|
144
|
-
lint:
|
|
145
|
-
runs-on: ubuntu-latest
|
|
146
|
-
steps:
|
|
147
|
-
- uses: actions/checkout@v4
|
|
148
|
-
- uses: actions/setup-node@v4
|
|
149
|
-
with:
|
|
150
|
-
node-version: '18'
|
|
151
|
-
registry-url: 'https://npm.pkg.github.com'
|
|
152
|
-
|
|
153
|
-
- name: Configure GitHub Package Registry
|
|
154
|
-
run: |
|
|
155
|
-
echo "@sun-asterisk:registry=https://npm.pkg.github.com" >> ~/.npmrc
|
|
156
|
-
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc
|
|
157
|
-
|
|
158
|
-
- run: npm ci
|
|
159
|
-
- name: Run SunLint
|
|
160
|
-
run: |
|
|
161
|
-
npx @sun-asterisk/sunlint --all --eslint-integration --changed-files \
|
|
162
|
-
--diff-base=origin/main --fail-on-new-violations --format=summary
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### **GitHub Actions with Direct Tarball**
|
|
166
|
-
|
|
167
|
-
```yaml
|
|
168
|
-
name: Code Quality
|
|
169
|
-
on: [pull_request]
|
|
170
|
-
|
|
171
|
-
jobs:
|
|
172
|
-
lint:
|
|
173
|
-
runs-on: ubuntu-latest
|
|
174
|
-
steps:
|
|
175
|
-
- uses: actions/checkout@v4
|
|
176
|
-
- uses: actions/setup-node@v4
|
|
177
|
-
|
|
178
|
-
- name: Install SunLint
|
|
179
|
-
run: |
|
|
180
|
-
npm install -g https://github.com/sun-asterisk/engineer-excellence/releases/download/sunlint-v1.0.5/sunlint-1.0.5.tgz
|
|
181
|
-
|
|
182
|
-
- name: Run SunLint
|
|
183
|
-
run: |
|
|
184
|
-
sunlint --all --eslint-integration --changed-files \
|
|
185
|
-
--diff-base=origin/main --fail-on-new-violations --format=summary
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## 🔍 **Verification**
|
|
189
|
-
|
|
190
|
-
After installation, verify SunLint is working:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
# Check version
|
|
194
|
-
sunlint --version
|
|
195
|
-
|
|
196
|
-
# Test basic functionality
|
|
197
|
-
sunlint --rule=C006 --input=src
|
|
198
|
-
|
|
199
|
-
# Test ESLint integration
|
|
200
|
-
sunlint --all --eslint-integration --input=src
|
|
201
|
-
|
|
202
|
-
# Test Git integration
|
|
203
|
-
sunlint --all --changed-files
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
## 📊 **Release Metrics**
|
|
207
|
-
|
|
208
|
-
Track adoption through:
|
|
209
|
-
- GitHub Package downloads
|
|
210
|
-
- GitHub Release download statistics
|
|
211
|
-
- GitHub stars/forks
|
|
212
|
-
- Issue reports and feature requests
|
|
213
|
-
|
|
214
|
-
## 🎉 **Benefits Summary**
|
|
215
|
-
|
|
216
|
-
### **For Teams**
|
|
217
|
-
- ✅ **Zero-disruption**: Works with existing ESLint
|
|
218
|
-
- ✅ **Flexible deployment**: GitHub Package or direct download
|
|
219
|
-
- ✅ **Enterprise-ready**: Private package distribution
|
|
220
|
-
- ✅ **CI/CD optimized**: Git integration for performance
|
|
221
|
-
|
|
222
|
-
### **For Maintainers**
|
|
223
|
-
- ✅ **Cost-effective**: No NPM Registry fees
|
|
224
|
-
- ✅ **Control**: Private distribution via GitHub
|
|
225
|
-
- ✅ **Automation**: GitHub Actions release pipeline
|
|
226
|
-
- ✅ **Monitoring**: Built-in download analytics
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
**🚀 Ready to deploy SunLint v1.0.5 with dual release strategy!**
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# Standardized Category Filtering
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
SunLint implements standardized category filtering to ensure consistent behavior between CLI and VSCode extension. Category commands (like `--security`, `--quality`) now use a unified approach that only includes rules from core files.
|
|
5
|
-
|
|
6
|
-
## Core Principles
|
|
7
|
-
|
|
8
|
-
### 1. Core Files Only
|
|
9
|
-
Category filtering exclusively uses rules from core files:
|
|
10
|
-
- `common-en.md` - Universal quality and security rules
|
|
11
|
-
- `security-en.md` - Specialized security rules
|
|
12
|
-
- Language-specific files (typescript-en.md, etc.) are **excluded** from category commands
|
|
13
|
-
|
|
14
|
-
### 2. Language-Specific Rules are Opt-In
|
|
15
|
-
- Language-specific rules are not included in category commands by default
|
|
16
|
-
- Must be explicitly enabled via project configuration
|
|
17
|
-
- This ensures category commands remain language-agnostic
|
|
18
|
-
|
|
19
|
-
### 3. Principle-Based Filtering
|
|
20
|
-
Rules are filtered by their `principle` field based on actual rule catalog:
|
|
21
|
-
- `--security` → includes rules with principle: "SECURITY"
|
|
22
|
-
- `--quality` → includes rules with principle: "CODE_QUALITY"
|
|
23
|
-
|
|
24
|
-
Available principles in rule catalog:
|
|
25
|
-
- **SECURITY** - Security-focused rules
|
|
26
|
-
- **CODE_QUALITY** - Code quality and maintainability
|
|
27
|
-
- **PERFORMANCE** - Performance optimization rules
|
|
28
|
-
- **MAINTAINABILITY** - Code maintainability rules
|
|
29
|
-
- **TESTABILITY** - Testing and testability rules
|
|
30
|
-
- **RELIABILITY** - System reliability rules
|
|
31
|
-
- **DESIGN_PATTERNS** - Design pattern compliance
|
|
32
|
-
- **INTEGRATION** - Integration best practices
|
|
33
|
-
- **USABILITY** - User experience and usability
|
|
34
|
-
|
|
35
|
-
## Implementation
|
|
36
|
-
|
|
37
|
-
### SunlintRuleAdapter Methods
|
|
38
|
-
|
|
39
|
-
```javascript
|
|
40
|
-
// Get rules for standardized category filtering (core files only)
|
|
41
|
-
getStandardCategoryRules(category) {
|
|
42
|
-
const coreRules = this.getCoreRules();
|
|
43
|
-
return coreRules.filter(rule => rule.principle === category);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Category mapping based on actual principles
|
|
47
|
-
const categoryPrincipleMap = {
|
|
48
|
-
'security': ['SECURITY'],
|
|
49
|
-
'quality': ['CODE_QUALITY'],
|
|
50
|
-
'performance': ['PERFORMANCE'],
|
|
51
|
-
'maintainability': ['MAINTAINABILITY'],
|
|
52
|
-
'testability': ['TESTABILITY'],
|
|
53
|
-
'reliability': ['RELIABILITY'],
|
|
54
|
-
'design': ['DESIGN_PATTERNS'],
|
|
55
|
-
'integration': ['INTEGRATION'],
|
|
56
|
-
'usability': ['USABILITY']
|
|
57
|
-
};
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### CLI Integration
|
|
61
|
-
|
|
62
|
-
The rule selection service now uses standardized category filtering:
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
// core/rule-selection-service.js
|
|
66
|
-
const rules = adapter.getStandardCategoryRules(category);
|
|
67
|
-
console.log(`📋 Selected ${rules.length} ${category} rules from core files`);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Rule Counts
|
|
71
|
-
|
|
72
|
-
Based on current rule catalog:
|
|
73
|
-
- **Total rules**: 256
|
|
74
|
-
- **Core rules**: 135 (common-en.md + security-en.md)
|
|
75
|
-
- **Security rules (core only)**: 60 rules
|
|
76
|
-
- **Quality rules (core only)**: 112 rules
|
|
77
|
-
- **Language-specific rules**: 121 rules (excluded from categories)
|
|
78
|
-
|
|
79
|
-
## Usage Examples
|
|
80
|
-
|
|
81
|
-
### CLI Commands
|
|
82
|
-
```bash
|
|
83
|
-
# Uses 60 security rules from core files only
|
|
84
|
-
sunlint --input=src --security
|
|
85
|
-
|
|
86
|
-
# Uses 112 quality rules from core files only
|
|
87
|
-
sunlint --input=src --quality
|
|
88
|
-
|
|
89
|
-
# Custom rule selection (can include language-specific)
|
|
90
|
-
sunlint --input=src --rules="TS001,TS002,S001"
|
|
91
|
-
|
|
92
|
-
# Future categories (when CLI support is added)
|
|
93
|
-
sunlint --input=src --performance
|
|
94
|
-
sunlint --input=src --maintainability
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Project Configuration
|
|
98
|
-
To include language-specific rules, use project config:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"rules": ["TS001", "TS002"],
|
|
103
|
-
"presets": ["typescript", "security"]
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Benefits
|
|
108
|
-
|
|
109
|
-
### 1. Consistency
|
|
110
|
-
- CLI and VSCode extension use identical rule selection logic
|
|
111
|
-
- Predictable behavior across all interfaces
|
|
112
|
-
|
|
113
|
-
### 2. Maintainability
|
|
114
|
-
- Single source of truth for category definitions
|
|
115
|
-
- Easy to add new categories or core rules
|
|
116
|
-
|
|
117
|
-
### 3. Extensibility
|
|
118
|
-
- Clear separation between core and language-specific rules
|
|
119
|
-
- Framework for adding new languages without breaking existing categories
|
|
120
|
-
|
|
121
|
-
### 4. Performance
|
|
122
|
-
- Reduced rule count for category commands
|
|
123
|
-
- Faster analysis for common security/quality checks
|
|
124
|
-
|
|
125
|
-
## Migration from Legacy System
|
|
126
|
-
|
|
127
|
-
### Before (Legacy)
|
|
128
|
-
- Category commands included all rules matching principle
|
|
129
|
-
- Language-specific rules were included by default
|
|
130
|
-
- Different behavior between CLI and VSCode extension
|
|
131
|
-
|
|
132
|
-
### After (Standardized)
|
|
133
|
-
- Category commands use core files only
|
|
134
|
-
- Language-specific rules are opt-in via config
|
|
135
|
-
- Unified behavior across all interfaces
|
|
136
|
-
|
|
137
|
-
## Validation
|
|
138
|
-
|
|
139
|
-
Use the test script to validate category filtering:
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
node test-category-filtering.js
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
Expected output:
|
|
146
|
-
- Core rules: 135
|
|
147
|
-
- Security rules (core): 60
|
|
148
|
-
- Quality rules (core): 112
|
|
149
|
-
- All tests pass ✅
|
|
150
|
-
|
|
151
|
-
## Related Files
|
|
152
|
-
|
|
153
|
-
- `core/adapters/sunlint-rule-adapter.js` - Main implementation
|
|
154
|
-
- `core/rule-selection-service.js` - CLI integration
|
|
155
|
-
- `test-category-filtering.js` - Validation script
|
|
156
|
-
- `config/presets/recommended.json` - Updated preset config
|
|
File without changes
|
|
File without changes
|