performance-optimizer 2.5.0__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ravi Kumar Vishwakarma
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,236 @@
1
+ Metadata-Version: 2.4
2
+ Name: performance-optimizer
3
+ Version: 2.5.0
4
+ Summary: Ultra-fast zero-dependency static performance analyzer for Angular, React, Node.js, SQL, and AWS.
5
+ Author: Performance Optimizer Core Team
6
+ License: MIT
7
+ Keywords: performance,static-analysis,angular,react,nodejs,sql,aws,latency,optimizer
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Topic :: Software Development :: Quality Assurance
11
+ Classifier: Topic :: Software Development :: Bug Tracking
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.7
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Requires-Python: >=3.7
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Dynamic: license-file
24
+
25
+ # Performance Optimizer v2.5 PRO β€” Advanced Multi-Stack Analyzer
26
+
27
+ > **NOT SonarQube.** This is an enterprise static performance & latency intelligence engine.
28
+ > **Targeted Runtimes**: Angular (14–19+), React (17–19+) & Next.js, Node.js & Seneca.js, SQL / Database Indexes, and AWS Serverless.
29
+ > Zero external dependencies β€” runs in `<0.05s` with Python 3.7+ standard library.
30
+
31
+ [![Live Portal](https://img.shields.io/badge/Live_Portal-GitHub_Pages-6366f1?style=for-the-badge&logo=github)](https://ravik27280.github.io/Performance-Optimizer/)
32
+ [![Python 3.7+](https://img.shields.io/badge/Python-3.7+-06b6d4?style=for-the-badge&logo=python)](https://www.python.org/)
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-10b981?style=for-the-badge)](https://opensource.org/licenses/MIT)
34
+
35
+ 🌐 **Live Interactive Web Portal & Diagnostic Scanner**: [https://ravik27280.github.io/Performance-Optimizer/](https://ravik27280.github.io/Performance-Optimizer/)
36
+
37
+ ---
38
+
39
+ ## ⚑ Installation & CLI Setup
40
+
41
+ Install locally or as an editable package for global terminal access:
42
+
43
+ ```bash
44
+ # Clone the repository
45
+ git clone https://github.com/Ravik27280/Performance-Optimizer.git
46
+ cd Performance-Optimizer
47
+
48
+ # Install package globally / in virtual environment
49
+ pip install -e .
50
+
51
+ # Verify CLI installation
52
+ perf-optimizer --help
53
+ ```
54
+
55
+ ---
56
+
57
+ ## πŸš€ Quick Start Examples
58
+
59
+ ```bash
60
+ # 1. Scan current repository / monorepo
61
+ perf-optimizer --project .
62
+
63
+ # 2. Scan separate frontend and backend directories
64
+ perf-optimizer --frontend ./angular-app --backend ./node-api
65
+
66
+ # 3. Enforce CI/CD Quality Gate (Exit 1 on critical issues or score < 75)
67
+ perf-optimizer --project . --fail-on critical --min-score 75
68
+
69
+ # 4. Generate HTML dashboard, JSON audit, and PR Markdown summary
70
+ perf-optimizer --project . --json --markdown-summary pr_summary.md --output report.html
71
+
72
+ # 5. Alternatively, run directly with python (zero pip packages required)
73
+ python optimizer.py --project . --verbose
74
+ ```
75
+
76
+ ---
77
+
78
+ ## πŸ“Š Output Formats
79
+
80
+ - **`performance_report.html`** β€” Interactive executive dashboard with code diff previews, ROI impact calculations, and dark/light modes.
81
+ - **`performance_report.json`** β€” Machine-readable audit data with exact line numbers and defect categories for custom tooling.
82
+ - **`pr_summary.md`** β€” Markdown report table designed for automated Pull Request comments in GitHub Actions and GitLab CI.
83
+
84
+ ---
85
+
86
+ ## πŸ€– GitHub Actions CI/CD Integration
87
+
88
+ Create `.github/workflows/perf-audit.yml` to automatically run audits on every Pull Request:
89
+
90
+ ```yaml
91
+ name: Performance Quality Gate
92
+
93
+ on:
94
+ push:
95
+ branches: [ main ]
96
+ pull_request:
97
+ branches: [ main ]
98
+
99
+ jobs:
100
+ audit:
101
+ runs-on: ubuntu-latest
102
+ steps:
103
+ - uses: actions/checkout@v4
104
+ - uses: actions/setup-python@v5
105
+ with:
106
+ python-version: '3.11'
107
+ - name: Install Performance Optimizer
108
+ run: pip install -e .
109
+ - name: Run Performance Audit
110
+ run: |
111
+ perf-optimizer --project . --fail-on critical --min-score 75
112
+ ```
113
+
114
+ ---
115
+
116
+ ## πŸ›‘οΈ CLI Flags & Options
117
+
118
+ | Argument | Description | Example |
119
+ |---|---|---|
120
+ | `--project`, `-p` | Path to monorepo or project (scans entire workspace) | `--project .` |
121
+ | `--frontend`, `-f` | Path to Angular or React frontend codebase | `--frontend ./src/web` |
122
+ | `--backend`, `-b` | Path to Node.js/Seneca/Express codebase | `--backend ./src/api` |
123
+ | `--fail-on` | Fails CI with exit code `1` if issues matching severity exist | `--fail-on critical` or `--fail-on high` |
124
+ | `--min-score` | Fails CI with exit code `1` if overall score is below threshold | `--min-score 75` |
125
+ | `--exclude`, `-e` | Comma-separated directory patterns to exclude | `--exclude "legacy,tmp,e2e"` |
126
+ | `--json`, `-j` | Generates machine-readable JSON report | `--json` |
127
+ | `--markdown-summary`, `-m` | Generates PR comment summary file | `--markdown-summary pr_summary.md` |
128
+ | `--output`, `-o` | Custom HTML report output path | `--output ./dist/perf_report.html` |
129
+ | `--verbose`, `-v` | Detailed terminal output during scan | `--verbose` |
130
+
131
+ ---
132
+
133
+ ## πŸ”‡ Inline Rule Suppression
134
+
135
+ Suppress false positives or accepted trade-offs directly in code:
136
+
137
+ ```typescript
138
+ // Angular / TypeScript / JavaScript
139
+ // perf-ignore ANG001
140
+ @Component({ ... })
141
+
142
+ // Node.js
143
+ // perf-ignore NODE001
144
+ const bootConfig = fs.readFileSync('boot.json', 'utf8');
145
+
146
+ // SQL / Schema
147
+ -- perf-ignore SQL004
148
+ CREATE TABLE temp_session ( ... );
149
+ ```
150
+
151
+ ---
152
+
153
+ ## πŸ” What It Detects (Performance-Specific)
154
+
155
+ ### Angular / Modern Frontend (Angular 16–19+)
156
+ | ID | Check | Category | Impact |
157
+ |---|---|---|---|
158
+ | **ANG001** | Missing OnPush Change Detection | DOM Re-render | 65% re-render reduction |
159
+ | **ANG002** | Direct @Input Property Mutation | Change Detection | Restores OnPush change detection |
160
+ | **ANG003** | `detectChanges()` Synchronously Inside Loop | Render Cycle | Eliminates N render cycles |
161
+ | **ANG004** | Observable Memory Leak (Missing Unsubscribe / Teardown) | Memory Leak | Eliminates heap growth per route |
162
+ | **ANG005** | Nested `subscribe()` Callback Anti-pattern | Concurrency | Eliminates race conditions & request leaks |
163
+ | **ANG006** | API Call Without Pagination (Full Collection Fetch) | Network & Heap | 70%+ TTI improvement |
164
+ | **ANG007** | Missing `debounceTime` on Reactive Form Streams | Network | Up to 85% fewer API requests |
165
+ | **ANG008** | Missing HTTP Response Caching (`shareReplay`) | Network | Eliminates duplicate network calls |
166
+ | **ANG009** | `*ngFor` Without `trackBy` or `@for` Without `track` | DOM Performance | 99% fewer DOM node recreations |
167
+ | **ANG010** | Missing Virtual Scrolling for Large Lists | DOM Performance | Renders only ~20 DOM nodes |
168
+ | **ANG011** | Method Calls in Template Interpolation | DOM Re-render | Eliminates expensive method re-evaluations |
169
+ | **ANG012** | Wildcard / Full Library Imports (`lodash`, `rxjs/Rx`) | Bundle Size | 50–80KB bundle reduction |
170
+ | **ANG013** | No Lazy Loading Routes (All Eager at Startup) | Bundle Size | 40–60% initial bundle cut |
171
+ | **ANG014** | Heavy Subcomponents Rendered Without `@defer` | Core Web Vitals | Speeds up LCP & initial chunk parse |
172
+
173
+ ### React & Next.js (React 17–19+)
174
+ | ID | Check | Category | Impact |
175
+ |---|---|---|---|
176
+ | **REACT001** | Array Index as `key` in List Rendering | Reconciliation | Enables DOM node reuse on mutations |
177
+ | **REACT002** | Direct State Mutation Anti-pattern | State Management | Prevents broken re-render schedules |
178
+ | **REACT003** | `useEffect` Missing Dependency Array | Render Loop | Eliminates runaway infinite re-render loops |
179
+ | **REACT004** | Expensive Array Calculations Without `useMemo` | CPU Efficiency | Avoids heavy sorting/filtering recalculations |
180
+ | **REACT005** | Eager Route Components Without `React.lazy()` | Bundle Size | 30–50% smaller initial JS chunks |
181
+ | **REACT006** | Context Value Recreated as New Object on Render | Re-render Cascade | Stops cascading subtree re-renders |
182
+
183
+ ### Node.js / Seneca / Express Backend
184
+ | ID | Check | Category | Impact |
185
+ |---|---|---|---|
186
+ | **NODE001** | Synchronous `fs` Calls in Runtime Execution Paths | Event Loop | Unblocks Node.js event loop |
187
+ | **NODE002** | Sequential `await` on Independent Operations | Concurrency | Up to 50% latency reduction |
188
+ | **NODE003** | Promise Chains Without `.catch()` | Stability | Prevents unhandled rejections |
189
+ | **NODE004** | **N+1 Database Query Pattern in Loop** | Database I/O | O(N) β†’ O(1) query roundtrips |
190
+ | **NODE005** | **Database Queries Without LIMIT (Returns All Rows)** | Database I/O | Caps payload and memory bounds |
191
+ | **NODE006** | No Caching Layer for Repeated Queries (Redis) | Database I/O | 60–90% database load reduction |
192
+ | **NODE007** | API Response Over-fetching (`SELECT *` to `res.json`) | Serialization | Smaller payloads, faster JSON encode |
193
+ | **NODE008** | Express Missing Gzip/Brotli Compression | Network | 70–90% smaller response sizes |
194
+ | **NODE009** | Unbounded In-Memory Array Growth | Memory Leak | Prevents OOM crashes |
195
+ | **NODE010** | Database Connection Pool Configured Too Small | Database I/O | Eliminates connection queue delays |
196
+ | **NODE011** | **EventEmitter Memory Leak (Missing Listener Teardown)** | Memory Leak | Eliminates closure/listener leaks |
197
+ | **NODE012** | **HTTP Requests Missing Connection Reuse (`keepAlive: true`)** | Network | Saves 50–100ms TLS handshakes |
198
+ | **SEN001** | Seneca `.act()` Inside Iteration Loop | Microservice RPC | NΓ—latency β†’ max(latency) |
199
+ | **SEN002** | Seneca `.act()` Without Explicit Timeout | Stability | Prevents cascading request hangs |
200
+
201
+ ### SQL / RDS / Database
202
+ | ID | Check | Category | Impact |
203
+ |---|---|---|---|
204
+ | **SQL001** | `SELECT *` Column Over-fetching | Database I/O | Faster queries, less I/O |
205
+ | **SQL002** | UPDATE/DELETE Without WHERE Clause | Data Integrity | Prevents full table locks & corruption |
206
+ | **SQL003** | SELECT Without LIMIT | Result Bounds | Fixed result set size |
207
+ | **SQL004** | **Missing Index on Foreign Key Columns** | Indexing | Converts O(N) table scan to O(log N) |
208
+ | **SQL005** | SQL Query Built via String Concatenation | Plan Cache | Reuses compiled query plans |
209
+ | **SQL006** | `LIKE '%query'` Leading Wildcard (B-Tree Incompatible) | Indexing | Enables index seeks |
210
+ | **SQL007** | **Deep OFFSET Pagination Antipattern** | Query Optimization | Keyset pagination saves O(N) discard |
211
+
212
+ ### AWS / Serverless / Cloud Infrastructure
213
+ | ID | Check | Category | Impact |
214
+ |---|---|---|---|
215
+ | **AWS001** | Lambda Memory Allocated Too Low (<512MB) | CPU & Latency | 50–75% faster execution |
216
+ | **AWS002** | Static S3 Hosting Without CloudFront CDN | Edge Delivery | 300ms β†’ 20ms global asset delivery |
217
+ | **AWS003** | Lambda Functions Without Explicit Timeout | Cost & Timeouts | Prevents runaway costs on hangs |
218
+ | **AWS005** | **Lambda Direct to RDS Without RDS Proxy** | Connection Pool | Prevents DB connection exhaustion |
219
+
220
+ ---
221
+
222
+ ## πŸ“ˆ Scoring Engine
223
+
224
+ - **Asymptotic Logarithmic Curve**: Avoids artificial zero-score cliffs; accurately reflects true performance health for codebases of any size.
225
+ - **Architectural Layer Weights**:
226
+ $$\text{Overall} = 40\% \text{Frontend} + 30\% \text{Backend} + 20\% \text{Database} + 10\% \text{Infra}$$
227
+ - **Priority Rank**: Calculated via $\text{Impact} / \max(\text{Effort}, 1)$ to prioritize high-impact, low-effort wins.
228
+
229
+ ---
230
+
231
+ ## πŸ§ͺ Automated Testing
232
+
233
+ Run the included unit test suite:
234
+ ```bash
235
+ python -m unittest discover -s tests -p "test_*.py" -v
236
+ ```
@@ -0,0 +1,212 @@
1
+ # Performance Optimizer v2.5 PRO β€” Advanced Multi-Stack Analyzer
2
+
3
+ > **NOT SonarQube.** This is an enterprise static performance & latency intelligence engine.
4
+ > **Targeted Runtimes**: Angular (14–19+), React (17–19+) & Next.js, Node.js & Seneca.js, SQL / Database Indexes, and AWS Serverless.
5
+ > Zero external dependencies β€” runs in `<0.05s` with Python 3.7+ standard library.
6
+
7
+ [![Live Portal](https://img.shields.io/badge/Live_Portal-GitHub_Pages-6366f1?style=for-the-badge&logo=github)](https://ravik27280.github.io/Performance-Optimizer/)
8
+ [![Python 3.7+](https://img.shields.io/badge/Python-3.7+-06b6d4?style=for-the-badge&logo=python)](https://www.python.org/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-10b981?style=for-the-badge)](https://opensource.org/licenses/MIT)
10
+
11
+ 🌐 **Live Interactive Web Portal & Diagnostic Scanner**: [https://ravik27280.github.io/Performance-Optimizer/](https://ravik27280.github.io/Performance-Optimizer/)
12
+
13
+ ---
14
+
15
+ ## ⚑ Installation & CLI Setup
16
+
17
+ Install locally or as an editable package for global terminal access:
18
+
19
+ ```bash
20
+ # Clone the repository
21
+ git clone https://github.com/Ravik27280/Performance-Optimizer.git
22
+ cd Performance-Optimizer
23
+
24
+ # Install package globally / in virtual environment
25
+ pip install -e .
26
+
27
+ # Verify CLI installation
28
+ perf-optimizer --help
29
+ ```
30
+
31
+ ---
32
+
33
+ ## πŸš€ Quick Start Examples
34
+
35
+ ```bash
36
+ # 1. Scan current repository / monorepo
37
+ perf-optimizer --project .
38
+
39
+ # 2. Scan separate frontend and backend directories
40
+ perf-optimizer --frontend ./angular-app --backend ./node-api
41
+
42
+ # 3. Enforce CI/CD Quality Gate (Exit 1 on critical issues or score < 75)
43
+ perf-optimizer --project . --fail-on critical --min-score 75
44
+
45
+ # 4. Generate HTML dashboard, JSON audit, and PR Markdown summary
46
+ perf-optimizer --project . --json --markdown-summary pr_summary.md --output report.html
47
+
48
+ # 5. Alternatively, run directly with python (zero pip packages required)
49
+ python optimizer.py --project . --verbose
50
+ ```
51
+
52
+ ---
53
+
54
+ ## πŸ“Š Output Formats
55
+
56
+ - **`performance_report.html`** β€” Interactive executive dashboard with code diff previews, ROI impact calculations, and dark/light modes.
57
+ - **`performance_report.json`** β€” Machine-readable audit data with exact line numbers and defect categories for custom tooling.
58
+ - **`pr_summary.md`** β€” Markdown report table designed for automated Pull Request comments in GitHub Actions and GitLab CI.
59
+
60
+ ---
61
+
62
+ ## πŸ€– GitHub Actions CI/CD Integration
63
+
64
+ Create `.github/workflows/perf-audit.yml` to automatically run audits on every Pull Request:
65
+
66
+ ```yaml
67
+ name: Performance Quality Gate
68
+
69
+ on:
70
+ push:
71
+ branches: [ main ]
72
+ pull_request:
73
+ branches: [ main ]
74
+
75
+ jobs:
76
+ audit:
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - uses: actions/checkout@v4
80
+ - uses: actions/setup-python@v5
81
+ with:
82
+ python-version: '3.11'
83
+ - name: Install Performance Optimizer
84
+ run: pip install -e .
85
+ - name: Run Performance Audit
86
+ run: |
87
+ perf-optimizer --project . --fail-on critical --min-score 75
88
+ ```
89
+
90
+ ---
91
+
92
+ ## πŸ›‘οΈ CLI Flags & Options
93
+
94
+ | Argument | Description | Example |
95
+ |---|---|---|
96
+ | `--project`, `-p` | Path to monorepo or project (scans entire workspace) | `--project .` |
97
+ | `--frontend`, `-f` | Path to Angular or React frontend codebase | `--frontend ./src/web` |
98
+ | `--backend`, `-b` | Path to Node.js/Seneca/Express codebase | `--backend ./src/api` |
99
+ | `--fail-on` | Fails CI with exit code `1` if issues matching severity exist | `--fail-on critical` or `--fail-on high` |
100
+ | `--min-score` | Fails CI with exit code `1` if overall score is below threshold | `--min-score 75` |
101
+ | `--exclude`, `-e` | Comma-separated directory patterns to exclude | `--exclude "legacy,tmp,e2e"` |
102
+ | `--json`, `-j` | Generates machine-readable JSON report | `--json` |
103
+ | `--markdown-summary`, `-m` | Generates PR comment summary file | `--markdown-summary pr_summary.md` |
104
+ | `--output`, `-o` | Custom HTML report output path | `--output ./dist/perf_report.html` |
105
+ | `--verbose`, `-v` | Detailed terminal output during scan | `--verbose` |
106
+
107
+ ---
108
+
109
+ ## πŸ”‡ Inline Rule Suppression
110
+
111
+ Suppress false positives or accepted trade-offs directly in code:
112
+
113
+ ```typescript
114
+ // Angular / TypeScript / JavaScript
115
+ // perf-ignore ANG001
116
+ @Component({ ... })
117
+
118
+ // Node.js
119
+ // perf-ignore NODE001
120
+ const bootConfig = fs.readFileSync('boot.json', 'utf8');
121
+
122
+ // SQL / Schema
123
+ -- perf-ignore SQL004
124
+ CREATE TABLE temp_session ( ... );
125
+ ```
126
+
127
+ ---
128
+
129
+ ## πŸ” What It Detects (Performance-Specific)
130
+
131
+ ### Angular / Modern Frontend (Angular 16–19+)
132
+ | ID | Check | Category | Impact |
133
+ |---|---|---|---|
134
+ | **ANG001** | Missing OnPush Change Detection | DOM Re-render | 65% re-render reduction |
135
+ | **ANG002** | Direct @Input Property Mutation | Change Detection | Restores OnPush change detection |
136
+ | **ANG003** | `detectChanges()` Synchronously Inside Loop | Render Cycle | Eliminates N render cycles |
137
+ | **ANG004** | Observable Memory Leak (Missing Unsubscribe / Teardown) | Memory Leak | Eliminates heap growth per route |
138
+ | **ANG005** | Nested `subscribe()` Callback Anti-pattern | Concurrency | Eliminates race conditions & request leaks |
139
+ | **ANG006** | API Call Without Pagination (Full Collection Fetch) | Network & Heap | 70%+ TTI improvement |
140
+ | **ANG007** | Missing `debounceTime` on Reactive Form Streams | Network | Up to 85% fewer API requests |
141
+ | **ANG008** | Missing HTTP Response Caching (`shareReplay`) | Network | Eliminates duplicate network calls |
142
+ | **ANG009** | `*ngFor` Without `trackBy` or `@for` Without `track` | DOM Performance | 99% fewer DOM node recreations |
143
+ | **ANG010** | Missing Virtual Scrolling for Large Lists | DOM Performance | Renders only ~20 DOM nodes |
144
+ | **ANG011** | Method Calls in Template Interpolation | DOM Re-render | Eliminates expensive method re-evaluations |
145
+ | **ANG012** | Wildcard / Full Library Imports (`lodash`, `rxjs/Rx`) | Bundle Size | 50–80KB bundle reduction |
146
+ | **ANG013** | No Lazy Loading Routes (All Eager at Startup) | Bundle Size | 40–60% initial bundle cut |
147
+ | **ANG014** | Heavy Subcomponents Rendered Without `@defer` | Core Web Vitals | Speeds up LCP & initial chunk parse |
148
+
149
+ ### React & Next.js (React 17–19+)
150
+ | ID | Check | Category | Impact |
151
+ |---|---|---|---|
152
+ | **REACT001** | Array Index as `key` in List Rendering | Reconciliation | Enables DOM node reuse on mutations |
153
+ | **REACT002** | Direct State Mutation Anti-pattern | State Management | Prevents broken re-render schedules |
154
+ | **REACT003** | `useEffect` Missing Dependency Array | Render Loop | Eliminates runaway infinite re-render loops |
155
+ | **REACT004** | Expensive Array Calculations Without `useMemo` | CPU Efficiency | Avoids heavy sorting/filtering recalculations |
156
+ | **REACT005** | Eager Route Components Without `React.lazy()` | Bundle Size | 30–50% smaller initial JS chunks |
157
+ | **REACT006** | Context Value Recreated as New Object on Render | Re-render Cascade | Stops cascading subtree re-renders |
158
+
159
+ ### Node.js / Seneca / Express Backend
160
+ | ID | Check | Category | Impact |
161
+ |---|---|---|---|
162
+ | **NODE001** | Synchronous `fs` Calls in Runtime Execution Paths | Event Loop | Unblocks Node.js event loop |
163
+ | **NODE002** | Sequential `await` on Independent Operations | Concurrency | Up to 50% latency reduction |
164
+ | **NODE003** | Promise Chains Without `.catch()` | Stability | Prevents unhandled rejections |
165
+ | **NODE004** | **N+1 Database Query Pattern in Loop** | Database I/O | O(N) β†’ O(1) query roundtrips |
166
+ | **NODE005** | **Database Queries Without LIMIT (Returns All Rows)** | Database I/O | Caps payload and memory bounds |
167
+ | **NODE006** | No Caching Layer for Repeated Queries (Redis) | Database I/O | 60–90% database load reduction |
168
+ | **NODE007** | API Response Over-fetching (`SELECT *` to `res.json`) | Serialization | Smaller payloads, faster JSON encode |
169
+ | **NODE008** | Express Missing Gzip/Brotli Compression | Network | 70–90% smaller response sizes |
170
+ | **NODE009** | Unbounded In-Memory Array Growth | Memory Leak | Prevents OOM crashes |
171
+ | **NODE010** | Database Connection Pool Configured Too Small | Database I/O | Eliminates connection queue delays |
172
+ | **NODE011** | **EventEmitter Memory Leak (Missing Listener Teardown)** | Memory Leak | Eliminates closure/listener leaks |
173
+ | **NODE012** | **HTTP Requests Missing Connection Reuse (`keepAlive: true`)** | Network | Saves 50–100ms TLS handshakes |
174
+ | **SEN001** | Seneca `.act()` Inside Iteration Loop | Microservice RPC | NΓ—latency β†’ max(latency) |
175
+ | **SEN002** | Seneca `.act()` Without Explicit Timeout | Stability | Prevents cascading request hangs |
176
+
177
+ ### SQL / RDS / Database
178
+ | ID | Check | Category | Impact |
179
+ |---|---|---|---|
180
+ | **SQL001** | `SELECT *` Column Over-fetching | Database I/O | Faster queries, less I/O |
181
+ | **SQL002** | UPDATE/DELETE Without WHERE Clause | Data Integrity | Prevents full table locks & corruption |
182
+ | **SQL003** | SELECT Without LIMIT | Result Bounds | Fixed result set size |
183
+ | **SQL004** | **Missing Index on Foreign Key Columns** | Indexing | Converts O(N) table scan to O(log N) |
184
+ | **SQL005** | SQL Query Built via String Concatenation | Plan Cache | Reuses compiled query plans |
185
+ | **SQL006** | `LIKE '%query'` Leading Wildcard (B-Tree Incompatible) | Indexing | Enables index seeks |
186
+ | **SQL007** | **Deep OFFSET Pagination Antipattern** | Query Optimization | Keyset pagination saves O(N) discard |
187
+
188
+ ### AWS / Serverless / Cloud Infrastructure
189
+ | ID | Check | Category | Impact |
190
+ |---|---|---|---|
191
+ | **AWS001** | Lambda Memory Allocated Too Low (<512MB) | CPU & Latency | 50–75% faster execution |
192
+ | **AWS002** | Static S3 Hosting Without CloudFront CDN | Edge Delivery | 300ms β†’ 20ms global asset delivery |
193
+ | **AWS003** | Lambda Functions Without Explicit Timeout | Cost & Timeouts | Prevents runaway costs on hangs |
194
+ | **AWS005** | **Lambda Direct to RDS Without RDS Proxy** | Connection Pool | Prevents DB connection exhaustion |
195
+
196
+ ---
197
+
198
+ ## πŸ“ˆ Scoring Engine
199
+
200
+ - **Asymptotic Logarithmic Curve**: Avoids artificial zero-score cliffs; accurately reflects true performance health for codebases of any size.
201
+ - **Architectural Layer Weights**:
202
+ $$\text{Overall} = 40\% \text{Frontend} + 30\% \text{Backend} + 20\% \text{Database} + 10\% \text{Infra}$$
203
+ - **Priority Rank**: Calculated via $\text{Impact} / \max(\text{Effort}, 1)$ to prioritize high-impact, low-effort wins.
204
+
205
+ ---
206
+
207
+ ## πŸ§ͺ Automated Testing
208
+
209
+ Run the included unit test suite:
210
+ ```bash
211
+ python -m unittest discover -s tests -p "test_*.py" -v
212
+ ```
File without changes