codeguardian-cli 1.2.2__py3-none-any.whl → 1.2.3__py3-none-any.whl
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.
- codeguardian_cli-1.2.3.dist-info/METADATA +446 -0
- {codeguardian_cli-1.2.2.dist-info → codeguardian_cli-1.2.3.dist-info}/RECORD +5 -5
- codeguardian_cli-1.2.2.dist-info/METADATA +0 -45
- {codeguardian_cli-1.2.2.dist-info → codeguardian_cli-1.2.3.dist-info}/WHEEL +0 -0
- {codeguardian_cli-1.2.2.dist-info → codeguardian_cli-1.2.3.dist-info}/entry_points.txt +0 -0
- {codeguardian_cli-1.2.2.dist-info → codeguardian_cli-1.2.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codeguardian-cli
|
|
3
|
+
Version: 1.2.3
|
|
4
|
+
Summary: Architecture and code quality analyzer
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: rich
|
|
8
|
+
Requires-Dist: typer
|
|
9
|
+
Requires-Dist: tree-sitter
|
|
10
|
+
Requires-Dist: tree-sitter-typescript
|
|
11
|
+
|
|
12
|
+
# CodeGuardian CLI
|
|
13
|
+
|
|
14
|
+
CodeGuardian CLI is a lightweight and extensible architecture and code quality analysis tool for Python, JavaScript, and TypeScript projects. It helps developers maintain clean project architecture by detecting code quality issues, dependency violations, circular dependencies, and direct database access while providing an overall architecture health score.
|
|
15
|
+
|
|
16
|
+
CodeGuardian is distributed as a PyPI package and can be easily integrated into your development workflow.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Architecture and code quality analysis.
|
|
23
|
+
- Architecture score calculation.
|
|
24
|
+
- Oversized file detection.
|
|
25
|
+
- Oversized function detection.
|
|
26
|
+
- Architecture rule validation.
|
|
27
|
+
- Circular dependency detection.
|
|
28
|
+
- Direct database access detection.
|
|
29
|
+
- Source code analysis.
|
|
30
|
+
- Automatic virtual environment detection and exclusion.
|
|
31
|
+
- Pre-commit hook support.
|
|
32
|
+
- Multi-language support:
|
|
33
|
+
- Python
|
|
34
|
+
- JavaScript
|
|
35
|
+
- TypeScript
|
|
36
|
+
- Multiple report formats:
|
|
37
|
+
- Console
|
|
38
|
+
- JSON
|
|
39
|
+
- HTML
|
|
40
|
+
- Markdown
|
|
41
|
+
- Easy installation through PyPI.
|
|
42
|
+
- Extensible and configurable architecture rules.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
Install CodeGuardian directly from PyPI:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install codeguardian-cli
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Verify the installation:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
codeguardian --help
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Supported Languages
|
|
63
|
+
|
|
64
|
+
| Language | Supported |
|
|
65
|
+
|---------|----------|
|
|
66
|
+
| Python | Yes |
|
|
67
|
+
| JavaScript | Yes |
|
|
68
|
+
| TypeScript | Yes |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Supported Commands
|
|
73
|
+
|
|
74
|
+
### Scan Command
|
|
75
|
+
|
|
76
|
+
The `scan` command performs a complete architecture and code quality analysis of a project.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
codeguardian scan <project_path>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Examples:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
codeguardian scan
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
codeguardian scan my_project
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
If no path is provided, the current working directory is scanned.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Report Command
|
|
97
|
+
|
|
98
|
+
The `report` command generates a summarized architecture report for the project.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
codeguardian report
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Scan Flags
|
|
107
|
+
|
|
108
|
+
The following flags are supported with the `scan` command:
|
|
109
|
+
|
|
110
|
+
| Flag | Description |
|
|
111
|
+
|------|------------|
|
|
112
|
+
| --json | Generate JSON report |
|
|
113
|
+
| --html | Generate HTML report |
|
|
114
|
+
| --markdown | Generate Markdown report |
|
|
115
|
+
| --details | Display detailed source code analysis |
|
|
116
|
+
| --score | Display architecture score |
|
|
117
|
+
|
|
118
|
+
Examples:
|
|
119
|
+
|
|
120
|
+
Generate JSON report:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
codeguardian scan . --json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Generate HTML report:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
codeguardian scan . --html
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Generate Markdown report:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
codeguardian scan . --markdown
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Display architecture score:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
codeguardian scan . --score
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Display detailed source code analysis:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
codeguardian scan . --details
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Combine multiple flags:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
codeguardian scan . --html --score
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Project Structure
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
CODEGUARDIAN/
|
|
162
|
+
│
|
|
163
|
+
├── analyzers/
|
|
164
|
+
│ ├── Circular Dependency Analyzer
|
|
165
|
+
│ ├── Database Access Analyzer
|
|
166
|
+
│ ├── Dependency Analyzer
|
|
167
|
+
│ ├── File Analyzer
|
|
168
|
+
│ ├── Function Analyzer
|
|
169
|
+
│ └── Source Code Analyzer
|
|
170
|
+
│
|
|
171
|
+
├── cli/
|
|
172
|
+
│ └── CLI Commands
|
|
173
|
+
│
|
|
174
|
+
├── config/
|
|
175
|
+
│ └── Configuration Loader
|
|
176
|
+
│
|
|
177
|
+
├── reports/
|
|
178
|
+
│ ├── Console Reporter
|
|
179
|
+
│ ├── HTML Reporter
|
|
180
|
+
│ ├── JSON Reporter
|
|
181
|
+
│ └── Markdown Reporter
|
|
182
|
+
│
|
|
183
|
+
├── rules/
|
|
184
|
+
│ └── Architecture Validator
|
|
185
|
+
│
|
|
186
|
+
├── src/
|
|
187
|
+
│ ├── Discovery
|
|
188
|
+
│ ├── Parser
|
|
189
|
+
│ └── Tree Walker
|
|
190
|
+
│
|
|
191
|
+
├── utils/
|
|
192
|
+
│ └── Utility Modules
|
|
193
|
+
│
|
|
194
|
+
├── main.py
|
|
195
|
+
│
|
|
196
|
+
└── __init__.py
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Architecture Score
|
|
202
|
+
|
|
203
|
+
CodeGuardian generates an overall architecture score that reflects the health of your project's architecture.
|
|
204
|
+
|
|
205
|
+
The score is calculated based on:
|
|
206
|
+
|
|
207
|
+
- Oversized files
|
|
208
|
+
- Oversized functions
|
|
209
|
+
- Architecture violations
|
|
210
|
+
- Circular dependencies
|
|
211
|
+
- Direct database access violations
|
|
212
|
+
|
|
213
|
+
The scoring mechanism can be customized through the configuration file.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Generated Reports
|
|
218
|
+
|
|
219
|
+
CodeGuardian supports multiple report formats.
|
|
220
|
+
|
|
221
|
+
### Console Report
|
|
222
|
+
|
|
223
|
+
Displayed directly in the terminal after running the scan command.
|
|
224
|
+
|
|
225
|
+
### HTML Report
|
|
226
|
+
|
|
227
|
+
Generated as:
|
|
228
|
+
|
|
229
|
+
```text
|
|
230
|
+
report.html
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### JSON Report
|
|
234
|
+
|
|
235
|
+
Generated as:
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
report.json
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Markdown Report
|
|
242
|
+
|
|
243
|
+
Generated as:
|
|
244
|
+
|
|
245
|
+
```text
|
|
246
|
+
report.md
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## Example Usage
|
|
252
|
+
|
|
253
|
+
Scan the current project:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
codeguardian scan .
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Scan a specific project:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
codeguardian scan backend_project
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Generate an HTML report:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
codeguardian scan . --html
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Generate a Markdown report:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
codeguardian scan . --markdown
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Generate a JSON report:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
codeguardian scan . --json
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Display architecture score:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
codeguardian scan . --score
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Display detailed source code analysis:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
codeguardian scan . --details
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
Generate a summarized report:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
codeguardian report
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Configuration
|
|
304
|
+
|
|
305
|
+
CodeGuardian uses a configuration file named:
|
|
306
|
+
|
|
307
|
+
```text
|
|
308
|
+
codeguardian.json
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
The configuration file allows developers to customize various project-specific settings, including:
|
|
312
|
+
|
|
313
|
+
- Maximum file line limit
|
|
314
|
+
- Maximum function line limit
|
|
315
|
+
- Supported file extensions
|
|
316
|
+
- Architecture scoring penalties
|
|
317
|
+
- Circular dependency checks
|
|
318
|
+
- Direct database access checks
|
|
319
|
+
- Architecture validation rules
|
|
320
|
+
- Additional project configurations
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## Automatic Virtual Environment Detection
|
|
325
|
+
|
|
326
|
+
CodeGuardian automatically skips Python virtual environments during project analysis.
|
|
327
|
+
|
|
328
|
+
Any directory containing:
|
|
329
|
+
|
|
330
|
+
```text
|
|
331
|
+
pyvenv.cfg
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
is automatically ignored during scanning.
|
|
335
|
+
|
|
336
|
+
Examples include:
|
|
337
|
+
|
|
338
|
+
```text
|
|
339
|
+
venv/
|
|
340
|
+
.venv/
|
|
341
|
+
test_env/
|
|
342
|
+
cg_env/
|
|
343
|
+
backend_env/
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
This prevents installed dependencies and packages from affecting architecture and code quality reports.
|
|
347
|
+
|
|
348
|
+
No additional configuration is required.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## Developer Notes
|
|
353
|
+
|
|
354
|
+
### Pre-Commit Hook Support
|
|
355
|
+
|
|
356
|
+
CodeGuardian provides a pre-commit hook that helps maintain architecture and code quality standards before every commit.
|
|
357
|
+
|
|
358
|
+
During the development of CodeGuardian itself, the repository contains sample files with intentional architecture violations, circular dependencies, and other test cases used for validation purposes.
|
|
359
|
+
|
|
360
|
+
These files may cause the pre-commit hook to block commits.
|
|
361
|
+
|
|
362
|
+
If required, the hook can be temporarily disabled.
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
### Windows (PowerShell)
|
|
367
|
+
|
|
368
|
+
Disable the hook:
|
|
369
|
+
|
|
370
|
+
```powershell
|
|
371
|
+
Rename-Item .git\hooks\pre-commit pre-commit.bak
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
Restore the hook:
|
|
375
|
+
|
|
376
|
+
```powershell
|
|
377
|
+
Rename-Item .git\hooks\pre-commit.bak pre-commit
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
### Linux / macOS
|
|
383
|
+
|
|
384
|
+
Disable the hook:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
mv .git/hooks/pre-commit .git/hooks/pre-commit.bak
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Restore the hook:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
mv .git/hooks/pre-commit.bak .git/hooks/pre-commit
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
### Reinstalling the Hook
|
|
399
|
+
|
|
400
|
+
If the hook is accidentally deleted or corrupted, it can be reinstalled using:
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
python install_hook.py
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## PyPI Package Information
|
|
409
|
+
|
|
410
|
+
| Field | Value |
|
|
411
|
+
|------|------|
|
|
412
|
+
| Package Name | codeguardian-cli |
|
|
413
|
+
| Current Version | 1.2.3 |
|
|
414
|
+
|
|
415
|
+
Install directly from PyPI:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
pip install codeguardian-cli
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Future Enhancements
|
|
424
|
+
|
|
425
|
+
Some planned improvements for future releases include:
|
|
426
|
+
|
|
427
|
+
- Framework-specific architecture rules.
|
|
428
|
+
- CI/CD pipeline integration.
|
|
429
|
+
- GitHub Actions support.
|
|
430
|
+
- Architecture visualization.
|
|
431
|
+
- Additional language support.
|
|
432
|
+
- Custom rule creation.
|
|
433
|
+
- IDE integrations.
|
|
434
|
+
- Advanced reporting capabilities.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## License
|
|
439
|
+
|
|
440
|
+
This project is licensed under the MIT License.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
444
|
+
## Authors
|
|
445
|
+
|
|
446
|
+
Developed by the CodeGuardian Team.
|
|
@@ -43,8 +43,8 @@ CODEGUARDIAN/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
|
43
43
|
CODEGUARDIAN/utils/ast_cache.py,sha256=XVbOWW_Iw-I3bge8mI923WfYCyEn9GZCyMWkYLe8_aI,777
|
|
44
44
|
CODEGUARDIAN/utils/file_cache.py,sha256=BCjiSAwZZYOq_pV57yWvrzBov8yPlkG_ZHsnSdaBZr8,510
|
|
45
45
|
CODEGUARDIAN/utils/layer_utils.py,sha256=QpUawYG8f5qjtIuXP0QBKEI_-W9kgHX9F2X_AvzrehM,248
|
|
46
|
-
codeguardian_cli-1.2.
|
|
47
|
-
codeguardian_cli-1.2.
|
|
48
|
-
codeguardian_cli-1.2.
|
|
49
|
-
codeguardian_cli-1.2.
|
|
50
|
-
codeguardian_cli-1.2.
|
|
46
|
+
codeguardian_cli-1.2.3.dist-info/METADATA,sha256=SrJMqkhylc4YmSq39cb9oEDuf7KlM5jwm9vD0DRUXto,7580
|
|
47
|
+
codeguardian_cli-1.2.3.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
48
|
+
codeguardian_cli-1.2.3.dist-info/entry_points.txt,sha256=I4OdLGA4ilsjlUDtu9NrmkswYu8vIjIpMaLL8koX11g,55
|
|
49
|
+
codeguardian_cli-1.2.3.dist-info/top_level.txt,sha256=FCCh2epuHzvBi_N-MJr-PFIPrWydRx1kRSDBVAdYbOw,13
|
|
50
|
+
codeguardian_cli-1.2.3.dist-info/RECORD,,
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: codeguardian-cli
|
|
3
|
-
Version: 1.2.2
|
|
4
|
-
Summary: Architecture and code quality analyzer
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: rich
|
|
8
|
-
Requires-Dist: typer
|
|
9
|
-
Requires-Dist: tree-sitter
|
|
10
|
-
Requires-Dist: tree-sitter-typescript
|
|
11
|
-
|
|
12
|
-
## Developer Note
|
|
13
|
-
|
|
14
|
-
While developing CodeGuardian itself, the pre-commit hook may block commits because the repository contains sample files with intentional architecture violations and circular dependencies.
|
|
15
|
-
|
|
16
|
-
To temporarily disable the hook:
|
|
17
|
-
|
|
18
|
-
### Windows (PowerShell)
|
|
19
|
-
|
|
20
|
-
```powershell
|
|
21
|
-
Rename-Item .git\hooks\pre-commit pre-commit.bak
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Linux/macOS
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
mv .git/hooks/pre-commit .git/hooks/pre-commit.bak
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
After committing, restore the hook:
|
|
31
|
-
|
|
32
|
-
### Windows (PowerShell)
|
|
33
|
-
|
|
34
|
-
```powershell
|
|
35
|
-
Rename-Item .git\hooks\pre-commit.bak pre-commit
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
or reinstall it:
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
python install_hook.py
|
|
44
|
-
```
|
|
45
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|