code-analyser 0.1.0__tar.gz → 1.0.1__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.
Files changed (91) hide show
  1. code_analyser-1.0.1/.gitignore +11 -0
  2. code_analyser-1.0.1/PKG-INFO +112 -0
  3. code_analyser-1.0.1/README.md +85 -0
  4. code_analyser-1.0.1/docs/superpowers/plans/2026-05-06-code-analyser-rewrite.md +3210 -0
  5. code_analyser-1.0.1/docs/superpowers/specs/2026-05-05-code-analyser-design.md +360 -0
  6. code_analyser-1.0.1/pyproject.toml +54 -0
  7. code_analyser-1.0.1/src/code_analyser/__init__.py +4 -0
  8. code_analyser-1.0.1/src/code_analyser/api.py +42 -0
  9. code_analyser-1.0.1/src/code_analyser/cli.py +108 -0
  10. code_analyser-1.0.1/src/code_analyser/core/__init__.py +0 -0
  11. code_analyser-1.0.1/src/code_analyser/core/css_.py +135 -0
  12. code_analyser-1.0.1/src/code_analyser/core/html_.py +240 -0
  13. code_analyser-1.0.1/src/code_analyser/core/javascript_.py +111 -0
  14. code_analyser-1.0.1/src/code_analyser/core/notebook_.py +61 -0
  15. code_analyser-1.0.1/src/code_analyser/core/python_.py +246 -0
  16. code_analyser-1.0.1/src/code_analyser/core/sql_.py +55 -0
  17. code_analyser-1.0.1/src/code_analyser/core/typescript_.py +63 -0
  18. code_analyser-1.0.1/src/code_analyser/detect.py +20 -0
  19. code_analyser-1.0.1/src/code_analyser/llm.py +81 -0
  20. code_analyser-1.0.1/src/code_analyser/models.py +186 -0
  21. code_analyser-1.0.1/src/code_analyser/pipeline.py +125 -0
  22. code_analyser-1.0.1/src/code_analyser/settings.py +12 -0
  23. code_analyser-1.0.1/tests/__init__.py +0 -0
  24. code_analyser-1.0.1/tests/api/__init__.py +0 -0
  25. code_analyser-1.0.1/tests/api/test_api.py +63 -0
  26. code_analyser-1.0.1/tests/cli/__init__.py +0 -0
  27. code_analyser-1.0.1/tests/cli/test_cli.py +43 -0
  28. code_analyser-1.0.1/tests/conftest.py +159 -0
  29. code_analyser-1.0.1/tests/integration/__init__.py +0 -0
  30. code_analyser-1.0.1/tests/integration/test_full_pipeline.py +36 -0
  31. code_analyser-1.0.1/tests/integration/test_pipeline.py +84 -0
  32. code_analyser-1.0.1/tests/unit/__init__.py +0 -0
  33. code_analyser-1.0.1/tests/unit/test_css_.py +67 -0
  34. code_analyser-1.0.1/tests/unit/test_detect.py +42 -0
  35. code_analyser-1.0.1/tests/unit/test_html_.py +85 -0
  36. code_analyser-1.0.1/tests/unit/test_javascript_.py +46 -0
  37. code_analyser-1.0.1/tests/unit/test_llm.py +38 -0
  38. code_analyser-1.0.1/tests/unit/test_models.py +116 -0
  39. code_analyser-1.0.1/tests/unit/test_notebook_.py +51 -0
  40. code_analyser-1.0.1/tests/unit/test_python_.py +85 -0
  41. code_analyser-1.0.1/tests/unit/test_scaffold.py +3 -0
  42. code_analyser-1.0.1/tests/unit/test_sql_.py +38 -0
  43. code_analyser-1.0.1/tests/unit/test_typescript_.py +37 -0
  44. code_analyser-1.0.1/uv.lock +827 -0
  45. code_analyser-0.1.0/CODE-LENS.md +0 -223
  46. code_analyser-0.1.0/DEPLOYMENT.md +0 -358
  47. code_analyser-0.1.0/Dockerfile +0 -56
  48. code_analyser-0.1.0/PKG-INFO +0 -283
  49. code_analyser-0.1.0/README.md +0 -244
  50. code_analyser-0.1.0/codelens/__init__.py +0 -7
  51. code_analyser-0.1.0/codelens/__main__.py +0 -19
  52. code_analyser-0.1.0/codelens/analyzers/__init__.py +0 -30
  53. code_analyser-0.1.0/codelens/analyzers/base.py +0 -139
  54. code_analyser-0.1.0/codelens/analyzers/manager.py +0 -207
  55. code_analyser-0.1.0/codelens/analyzers/python_analyzer.py +0 -344
  56. code_analyser-0.1.0/codelens/analyzers/similarity_analyzer.py +0 -512
  57. code_analyser-0.1.0/codelens/api/__init__.py +0 -1
  58. code_analyser-0.1.0/codelens/api/routes/__init__.py +0 -1
  59. code_analyser-0.1.0/codelens/api/routes/analysis.py +0 -441
  60. code_analyser-0.1.0/codelens/api/routes/reports.py +0 -438
  61. code_analyser-0.1.0/codelens/api/routes/rubrics.py +0 -349
  62. code_analyser-0.1.0/codelens/api/schemas.py +0 -305
  63. code_analyser-0.1.0/codelens/cli.py +0 -297
  64. code_analyser-0.1.0/codelens/core/__init__.py +0 -1
  65. code_analyser-0.1.0/codelens/core/config.py +0 -91
  66. code_analyser-0.1.0/codelens/db/__init__.py +0 -1
  67. code_analyser-0.1.0/codelens/db/database.py +0 -57
  68. code_analyser-0.1.0/codelens/main.py +0 -111
  69. code_analyser-0.1.0/codelens/models/__init__.py +0 -14
  70. code_analyser-0.1.0/codelens/models/assignments.py +0 -105
  71. code_analyser-0.1.0/codelens/models/reports.py +0 -172
  72. code_analyser-0.1.0/codelens/models/rubrics.py +0 -76
  73. code_analyser-0.1.0/codelens/services/__init__.py +0 -37
  74. code_analyser-0.1.0/codelens/services/batch_processor.py +0 -508
  75. code_analyser-0.1.0/codelens/services/code_executor.py +0 -310
  76. code_analyser-0.1.0/codelens/services/sandbox.py +0 -375
  77. code_analyser-0.1.0/codelens/services/similarity_service.py +0 -449
  78. code_analyser-0.1.0/codelens/utils/__init__.py +0 -29
  79. code_analyser-0.1.0/codelens/utils/helpers.py +0 -217
  80. code_analyser-0.1.0/docker-compose.prod.yml +0 -91
  81. code_analyser-0.1.0/docker-compose.yml +0 -58
  82. code_analyser-0.1.0/nginx.conf +0 -184
  83. code_analyser-0.1.0/pyproject.toml +0 -120
  84. code_analyser-0.1.0/scripts/deploy/README.md +0 -272
  85. code_analyser-0.1.0/scripts/deploy/docker_deploy.sh +0 -118
  86. code_analyser-0.1.0/scripts/deploy/server_install.sh +0 -204
  87. code_analyser-0.1.0/scripts/deploy/server_update.sh +0 -85
  88. code_analyser-0.1.0/uv.lock +0 -1671
  89. {code_analyser-0.1.0 → code_analyser-1.0.1}/.dockerignore +0 -0
  90. {code_analyser-0.1.0 → code_analyser-1.0.1}/.env.example +0 -0
  91. {code_analyser-0.1.0 → code_analyser-1.0.1}/LICENSE +0 -0
@@ -0,0 +1,11 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.pyo
4
+ *.pyd
5
+ .Python
6
+ *.egg-info/
7
+ dist/
8
+ .pytest_cache/
9
+ .coverage
10
+ htmlcov/
11
+ .env
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: code-analyser
3
+ Version: 1.0.1
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 code_analyser 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 code_analyser.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
+ | [auto-analyser](https://github.com/michael-borck/auto-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 code_analyser 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 code_analyser.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
+ | [auto-analyser](https://github.com/michael-borck/auto-analyser) | any file — detects format and routes to the right tool |
82
+
83
+ ## License
84
+
85
+ MIT