Source code analyser — part of the analyser family
Project description
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 codelens 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 codelens.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 |
| multi-analyser | any file — detects format and routes to the right tool |
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_analyser-1.0.0.tar.gz.
File metadata
- Download URL: code_analyser-1.0.0.tar.gz
- Upload date:
- Size: 152.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
639cbed054f25381de815d59a0472a65052a9c396cc09c6fe0f8b84c05c5eefa
|
|
| MD5 |
cb077f05c128b6b9f08fc88c95c30f55
|
|
| BLAKE2b-256 |
936f5128ce5b809c574243ef7c19a3bd58e27de0fd99ae4426265563922387d9
|
File details
Details for the file code_analyser-1.0.0-py3-none-any.whl.
File metadata
- Download URL: code_analyser-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1b568a785bf8715e6420e860b882fbaf802c5620c11ff3180153995138dcef0
|
|
| MD5 |
7511127a41b53f12a38ef8d37f8348eb
|
|
| BLAKE2b-256 |
0466b62426415cee4a0e1222952df74767618c93080018af4cfb5ac9ae195dd6
|