code-analyser
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.
Part of the analyser family.
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.
Install
pip install code-analyser
Requires Python 3.11+.
Usage
Python
from code_analyser import analyse
result = analyse("submission.py")
print(f"Lines: {result['metrics']['lines_of_code']}")
print(f"Complexity: {result['metrics']['cyclomatic_complexity']}")
print(f"Issues: {len(result['issues'])}")
HTTP API
# Start the server
uvicorn code_analyser.main:app --port 8004
curl -X POST http://localhost:8004/api/v1/analyze/python \
-H "Content-Type: application/json" \
-d '{"code": "def hello():\n print(\"Hello\")", "language": "python"}'
Supported languages
| Language | Status |
|---|---|
| Python | supported (ruff, AST metrics) |
| JavaScript, Java, others | planned |
Output
{
"language": "python",
"metrics": {
"lines_of_code": 42,
"cyclomatic_complexity": 3,
"maintainability_index": 74.2
},
"issues": [
{"rule": "E501", "line": 12, "message": "line too long (92 > 88 characters)"}
],
"summary": {
"error_count": 0,
"warning_count": 1,
"style_count": 2
}
}
The analyser family
Low-level analysis tools. Each accepts files directly and returns structured JSON. Build your own UI or pipeline on top.
| Package | Handles |
|---|---|
| speech-analyser | audio and video files — transcript and speech metrics |
| video-analyser | video files — frames, scenes, and visual quality |
| document-analyser | PDF, DOCX, PPTX, TXT — text and readability |
| code-analyser | source code — style, complexity, and quality metrics |
| records-analyser | CSV, Excel, SQLite, Parquet, JSON — data profiling |
| auto-analyser | any file — detects format and routes to the right tool |
License
MIT
Metadata
Release files for code-analyser 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| code_analyser-1.4.0.tar.gz | 199.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| code_analyser-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 224.2 kB
Release files / code_analyser-1.4.0.tar.gz
| Download URL | code_analyser-1.4.0.tar.gz |
|---|---|
| Size | 199.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ede82a3add4f4a18600cd69bf9cde7271729c01e7962c7b0fb4c8f4191427c87
|
|
BLAKE2b-256 checksum How to use checksums |
1a9d3b51c2fbd8f7184fb70e91475272da2fe8aa51b2e6fee505bac81d584199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / code_analyser-1.4.0-py3-none-any.whl
| Download URL | code_analyser-1.4.0-py3-none-any.whl |
|---|---|
| Size | 25.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c812eb8495a1ae39bf73e27744cc49817faf454bbe12eb50d608cfd3ac75b0e7
|
|
BLAKE2b-256 checksum How to use checksums |
a7277229ceca308c742f00d08baf0227a634ee92d10b74fcc274947324e9e991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|