code-analyser 0.1.0__tar.gz → 1.0.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.
- code_analyser-1.0.0/.gitignore +11 -0
- code_analyser-1.0.0/PKG-INFO +112 -0
- code_analyser-1.0.0/README.md +85 -0
- code_analyser-1.0.0/docs/superpowers/plans/2026-05-06-code-analyser-rewrite.md +3210 -0
- code_analyser-1.0.0/docs/superpowers/specs/2026-05-05-code-analyser-design.md +360 -0
- code_analyser-1.0.0/pyproject.toml +54 -0
- code_analyser-1.0.0/src/code_analyser/__init__.py +4 -0
- code_analyser-1.0.0/src/code_analyser/api.py +42 -0
- code_analyser-1.0.0/src/code_analyser/cli.py +108 -0
- code_analyser-1.0.0/src/code_analyser/core/__init__.py +0 -0
- code_analyser-1.0.0/src/code_analyser/core/css_.py +135 -0
- code_analyser-1.0.0/src/code_analyser/core/html_.py +240 -0
- code_analyser-1.0.0/src/code_analyser/core/javascript_.py +111 -0
- code_analyser-1.0.0/src/code_analyser/core/notebook_.py +61 -0
- code_analyser-1.0.0/src/code_analyser/core/python_.py +246 -0
- code_analyser-1.0.0/src/code_analyser/core/sql_.py +55 -0
- code_analyser-1.0.0/src/code_analyser/core/typescript_.py +63 -0
- code_analyser-1.0.0/src/code_analyser/detect.py +20 -0
- code_analyser-1.0.0/src/code_analyser/llm.py +81 -0
- code_analyser-1.0.0/src/code_analyser/models.py +186 -0
- code_analyser-1.0.0/src/code_analyser/pipeline.py +125 -0
- code_analyser-1.0.0/src/code_analyser/settings.py +12 -0
- code_analyser-1.0.0/tests/__init__.py +0 -0
- code_analyser-1.0.0/tests/api/__init__.py +0 -0
- code_analyser-1.0.0/tests/api/test_api.py +63 -0
- code_analyser-1.0.0/tests/cli/__init__.py +0 -0
- code_analyser-1.0.0/tests/cli/test_cli.py +43 -0
- code_analyser-1.0.0/tests/conftest.py +159 -0
- code_analyser-1.0.0/tests/integration/__init__.py +0 -0
- code_analyser-1.0.0/tests/integration/test_full_pipeline.py +36 -0
- code_analyser-1.0.0/tests/integration/test_pipeline.py +84 -0
- code_analyser-1.0.0/tests/unit/__init__.py +0 -0
- code_analyser-1.0.0/tests/unit/test_css_.py +67 -0
- code_analyser-1.0.0/tests/unit/test_detect.py +42 -0
- code_analyser-1.0.0/tests/unit/test_html_.py +85 -0
- code_analyser-1.0.0/tests/unit/test_javascript_.py +46 -0
- code_analyser-1.0.0/tests/unit/test_llm.py +38 -0
- code_analyser-1.0.0/tests/unit/test_models.py +116 -0
- code_analyser-1.0.0/tests/unit/test_notebook_.py +51 -0
- code_analyser-1.0.0/tests/unit/test_python_.py +85 -0
- code_analyser-1.0.0/tests/unit/test_scaffold.py +3 -0
- code_analyser-1.0.0/tests/unit/test_sql_.py +38 -0
- code_analyser-1.0.0/tests/unit/test_typescript_.py +37 -0
- code_analyser-0.1.0/DEPLOYMENT.md +0 -358
- code_analyser-0.1.0/Dockerfile +0 -56
- code_analyser-0.1.0/PKG-INFO +0 -283
- code_analyser-0.1.0/README.md +0 -244
- code_analyser-0.1.0/codelens/__init__.py +0 -7
- code_analyser-0.1.0/codelens/__main__.py +0 -19
- code_analyser-0.1.0/codelens/analyzers/__init__.py +0 -30
- code_analyser-0.1.0/codelens/analyzers/base.py +0 -139
- code_analyser-0.1.0/codelens/analyzers/manager.py +0 -207
- code_analyser-0.1.0/codelens/analyzers/python_analyzer.py +0 -344
- code_analyser-0.1.0/codelens/analyzers/similarity_analyzer.py +0 -512
- code_analyser-0.1.0/codelens/api/__init__.py +0 -1
- code_analyser-0.1.0/codelens/api/routes/__init__.py +0 -1
- code_analyser-0.1.0/codelens/api/routes/analysis.py +0 -441
- code_analyser-0.1.0/codelens/api/routes/reports.py +0 -438
- code_analyser-0.1.0/codelens/api/routes/rubrics.py +0 -349
- code_analyser-0.1.0/codelens/api/schemas.py +0 -305
- code_analyser-0.1.0/codelens/cli.py +0 -297
- code_analyser-0.1.0/codelens/core/__init__.py +0 -1
- code_analyser-0.1.0/codelens/core/config.py +0 -91
- code_analyser-0.1.0/codelens/db/__init__.py +0 -1
- code_analyser-0.1.0/codelens/db/database.py +0 -57
- code_analyser-0.1.0/codelens/main.py +0 -111
- code_analyser-0.1.0/codelens/models/__init__.py +0 -14
- code_analyser-0.1.0/codelens/models/assignments.py +0 -105
- code_analyser-0.1.0/codelens/models/reports.py +0 -172
- code_analyser-0.1.0/codelens/models/rubrics.py +0 -76
- code_analyser-0.1.0/codelens/services/__init__.py +0 -37
- code_analyser-0.1.0/codelens/services/batch_processor.py +0 -508
- code_analyser-0.1.0/codelens/services/code_executor.py +0 -310
- code_analyser-0.1.0/codelens/services/sandbox.py +0 -375
- code_analyser-0.1.0/codelens/services/similarity_service.py +0 -449
- code_analyser-0.1.0/codelens/utils/__init__.py +0 -29
- code_analyser-0.1.0/codelens/utils/helpers.py +0 -217
- code_analyser-0.1.0/docker-compose.prod.yml +0 -91
- code_analyser-0.1.0/docker-compose.yml +0 -58
- code_analyser-0.1.0/nginx.conf +0 -184
- code_analyser-0.1.0/pyproject.toml +0 -120
- code_analyser-0.1.0/scripts/deploy/README.md +0 -272
- code_analyser-0.1.0/scripts/deploy/docker_deploy.sh +0 -118
- code_analyser-0.1.0/scripts/deploy/server_install.sh +0 -204
- code_analyser-0.1.0/scripts/deploy/server_update.sh +0 -85
- {code_analyser-0.1.0 → code_analyser-1.0.0}/.dockerignore +0 -0
- {code_analyser-0.1.0 → code_analyser-1.0.0}/.env.example +0 -0
- {code_analyser-0.1.0 → code_analyser-1.0.0}/CODE-LENS.md +0 -0
- {code_analyser-0.1.0 → code_analyser-1.0.0}/LICENSE +0 -0
- {code_analyser-0.1.0 → code_analyser-1.0.0}/uv.lock +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code-analyser
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Source code analyser — part of the analyser family
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: esprima>=4.0.0
|
|
8
|
+
Requires-Dist: fastapi>=0.109.0
|
|
9
|
+
Requires-Dist: html5lib>=1.1
|
|
10
|
+
Requires-Dist: httpx>=0.27.0
|
|
11
|
+
Requires-Dist: pydantic-settings>=2.1.0
|
|
12
|
+
Requires-Dist: pydantic>=2.5.0
|
|
13
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
14
|
+
Requires-Dist: rich>=13.7.0
|
|
15
|
+
Requires-Dist: ruff>=0.4.0
|
|
16
|
+
Requires-Dist: sqlparse>=0.4.4
|
|
17
|
+
Requires-Dist: tinycss2>=1.2.0
|
|
18
|
+
Requires-Dist: uvicorn>=0.27.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: httpx>=0.27.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
23
|
+
Requires-Dist: ruff>=0.4.0; extra == 'dev'
|
|
24
|
+
Provides-Extra: llm
|
|
25
|
+
Requires-Dist: anthropic>=0.7.0; extra == 'llm'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# code-analyser
|
|
29
|
+
|
|
30
|
+
Analyses source code files and returns style violations, complexity metrics, and quality indicators. Designed as a low-level tool — feed it a file, get back structured JSON.
|
|
31
|
+
|
|
32
|
+
Part of the [analyser family](#the-analyser-family).
|
|
33
|
+
|
|
34
|
+
> **Status**: Early development. Currently supports Python via ruff and basic AST metrics. Multi-language support and alignment with the family API pattern is in progress.
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install code-analyser
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Requires Python 3.11+.
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Python
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from codelens import analyse
|
|
50
|
+
|
|
51
|
+
result = analyse("submission.py")
|
|
52
|
+
|
|
53
|
+
print(f"Lines: {result['metrics']['lines_of_code']}")
|
|
54
|
+
print(f"Complexity: {result['metrics']['cyclomatic_complexity']}")
|
|
55
|
+
print(f"Issues: {len(result['issues'])}")
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### HTTP API
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Start the server
|
|
62
|
+
uvicorn codelens.main:app --port 8004
|
|
63
|
+
|
|
64
|
+
curl -X POST http://localhost:8004/api/v1/analyze/python \
|
|
65
|
+
-H "Content-Type: application/json" \
|
|
66
|
+
-d '{"code": "def hello():\n print(\"Hello\")", "language": "python"}'
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Supported languages
|
|
70
|
+
|
|
71
|
+
| Language | Status |
|
|
72
|
+
|---|---|
|
|
73
|
+
| Python | supported (ruff, AST metrics) |
|
|
74
|
+
| JavaScript, Java, others | planned |
|
|
75
|
+
|
|
76
|
+
## Output
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"language": "python",
|
|
81
|
+
"metrics": {
|
|
82
|
+
"lines_of_code": 42,
|
|
83
|
+
"cyclomatic_complexity": 3,
|
|
84
|
+
"maintainability_index": 74.2
|
|
85
|
+
},
|
|
86
|
+
"issues": [
|
|
87
|
+
{"rule": "E501", "line": 12, "message": "line too long (92 > 88 characters)"}
|
|
88
|
+
],
|
|
89
|
+
"summary": {
|
|
90
|
+
"error_count": 0,
|
|
91
|
+
"warning_count": 1,
|
|
92
|
+
"style_count": 2
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## The analyser family
|
|
98
|
+
|
|
99
|
+
Low-level analysis tools. Each accepts files directly and returns structured JSON. Build your own UI or pipeline on top.
|
|
100
|
+
|
|
101
|
+
| Package | Handles |
|
|
102
|
+
|---|---|
|
|
103
|
+
| [speech-analyser](https://github.com/michael-borck/speech-analyser) | audio and video files — transcript and speech metrics |
|
|
104
|
+
| [video-analyser](https://github.com/michael-borck/video-analyser) | video files — frames, scenes, and visual quality |
|
|
105
|
+
| [document-analyser](https://github.com/michael-borck/document-analyser) | PDF, DOCX, PPTX, TXT — text and readability |
|
|
106
|
+
| [code-analyser](https://github.com/michael-borck/code-analyser) | source code — style, complexity, and quality metrics |
|
|
107
|
+
| [records-analyser](https://github.com/michael-borck/records-analyser) | CSV, Excel, SQLite, Parquet, JSON — data profiling |
|
|
108
|
+
| [multi-analyser](https://github.com/michael-borck/multi-analyser) | any file — detects format and routes to the right tool |
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# code-analyser
|
|
2
|
+
|
|
3
|
+
Analyses source code files and returns style violations, complexity metrics, and quality indicators. Designed as a low-level tool — feed it a file, get back structured JSON.
|
|
4
|
+
|
|
5
|
+
Part of the [analyser family](#the-analyser-family).
|
|
6
|
+
|
|
7
|
+
> **Status**: Early development. Currently supports Python via ruff and basic AST metrics. Multi-language support and alignment with the family API pattern is in progress.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install code-analyser
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires Python 3.11+.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Python
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from codelens import analyse
|
|
23
|
+
|
|
24
|
+
result = analyse("submission.py")
|
|
25
|
+
|
|
26
|
+
print(f"Lines: {result['metrics']['lines_of_code']}")
|
|
27
|
+
print(f"Complexity: {result['metrics']['cyclomatic_complexity']}")
|
|
28
|
+
print(f"Issues: {len(result['issues'])}")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### HTTP API
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Start the server
|
|
35
|
+
uvicorn codelens.main:app --port 8004
|
|
36
|
+
|
|
37
|
+
curl -X POST http://localhost:8004/api/v1/analyze/python \
|
|
38
|
+
-H "Content-Type: application/json" \
|
|
39
|
+
-d '{"code": "def hello():\n print(\"Hello\")", "language": "python"}'
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Supported languages
|
|
43
|
+
|
|
44
|
+
| Language | Status |
|
|
45
|
+
|---|---|
|
|
46
|
+
| Python | supported (ruff, AST metrics) |
|
|
47
|
+
| JavaScript, Java, others | planned |
|
|
48
|
+
|
|
49
|
+
## Output
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"language": "python",
|
|
54
|
+
"metrics": {
|
|
55
|
+
"lines_of_code": 42,
|
|
56
|
+
"cyclomatic_complexity": 3,
|
|
57
|
+
"maintainability_index": 74.2
|
|
58
|
+
},
|
|
59
|
+
"issues": [
|
|
60
|
+
{"rule": "E501", "line": 12, "message": "line too long (92 > 88 characters)"}
|
|
61
|
+
],
|
|
62
|
+
"summary": {
|
|
63
|
+
"error_count": 0,
|
|
64
|
+
"warning_count": 1,
|
|
65
|
+
"style_count": 2
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## The analyser family
|
|
71
|
+
|
|
72
|
+
Low-level analysis tools. Each accepts files directly and returns structured JSON. Build your own UI or pipeline on top.
|
|
73
|
+
|
|
74
|
+
| Package | Handles |
|
|
75
|
+
|---|---|
|
|
76
|
+
| [speech-analyser](https://github.com/michael-borck/speech-analyser) | audio and video files — transcript and speech metrics |
|
|
77
|
+
| [video-analyser](https://github.com/michael-borck/video-analyser) | video files — frames, scenes, and visual quality |
|
|
78
|
+
| [document-analyser](https://github.com/michael-borck/document-analyser) | PDF, DOCX, PPTX, TXT — text and readability |
|
|
79
|
+
| [code-analyser](https://github.com/michael-borck/code-analyser) | source code — style, complexity, and quality metrics |
|
|
80
|
+
| [records-analyser](https://github.com/michael-borck/records-analyser) | CSV, Excel, SQLite, Parquet, JSON — data profiling |
|
|
81
|
+
| [multi-analyser](https://github.com/michael-borck/multi-analyser) | any file — detects format and routes to the right tool |
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|