coding-convention-reviewer 0.1.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.
- coding_convention_reviewer-0.1.0/.dockerignore +12 -0
- coding_convention_reviewer-0.1.0/.github/dependabot.yml +14 -0
- coding_convention_reviewer-0.1.0/.github/workflows/ci.yml +49 -0
- coding_convention_reviewer-0.1.0/.github/workflows/pr-review.yml +20 -0
- coding_convention_reviewer-0.1.0/.github/workflows/publish.yml +24 -0
- coding_convention_reviewer-0.1.0/.gitignore +11 -0
- coding_convention_reviewer-0.1.0/.pre-commit-config.yaml +5 -0
- coding_convention_reviewer-0.1.0/.pre-commit-hooks.yaml +9 -0
- coding_convention_reviewer-0.1.0/.vscode/tasks.json +107 -0
- coding_convention_reviewer-0.1.0/CLAUDE.md +107 -0
- coding_convention_reviewer-0.1.0/Dockerfile +34 -0
- coding_convention_reviewer-0.1.0/PKG-INFO +22 -0
- coding_convention_reviewer-0.1.0/README.md +345 -0
- coding_convention_reviewer-0.1.0/docker-compose.yml +28 -0
- coding_convention_reviewer-0.1.0/docs/CODEBASE_GUIDE.md +712 -0
- coding_convention_reviewer-0.1.0/docs/USER_GUIDE.md +402 -0
- coding_convention_reviewer-0.1.0/install.cmd +221 -0
- coding_convention_reviewer-0.1.0/pyproject.toml +42 -0
- coding_convention_reviewer-0.1.0/seireitei/.gitignore +36 -0
- coding_convention_reviewer-0.1.0/seireitei/.prettierignore +7 -0
- coding_convention_reviewer-0.1.0/seireitei/.prettierrc +11 -0
- coding_convention_reviewer-0.1.0/seireitei/README.md +21 -0
- coding_convention_reviewer-0.1.0/seireitei/app/favicon.ico +0 -0
- coding_convention_reviewer-0.1.0/seireitei/app/globals.css +194 -0
- coding_convention_reviewer-0.1.0/seireitei/app/history/page.tsx +232 -0
- coding_convention_reviewer-0.1.0/seireitei/app/layout.tsx +45 -0
- coding_convention_reviewer-0.1.0/seireitei/app/page.tsx +110 -0
- coding_convention_reviewer-0.1.0/seireitei/components/.gitkeep +0 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/analytics.tsx +180 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/dashboard-header.tsx +47 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/filters-bar.tsx +90 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/scan-diff.tsx +155 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/scan-form.tsx +77 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/scan-history.tsx +91 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/stats-grid.tsx +48 -0
- coding_convention_reviewer-0.1.0/seireitei/components/dashboard/status-banner.tsx +60 -0
- coding_convention_reviewer-0.1.0/seireitei/components/findings/finding-detail-panel.tsx +146 -0
- coding_convention_reviewer-0.1.0/seireitei/components/findings/findings-table.tsx +104 -0
- coding_convention_reviewer-0.1.0/seireitei/components/findings/severity-badge.tsx +15 -0
- coding_convention_reviewer-0.1.0/seireitei/components/shared/error-boundary.tsx +33 -0
- coding_convention_reviewer-0.1.0/seireitei/components/shared/field.tsx +45 -0
- coding_convention_reviewer-0.1.0/seireitei/components/shared/stat-card.tsx +25 -0
- coding_convention_reviewer-0.1.0/seireitei/components/shared/table-pagination.tsx +122 -0
- coding_convention_reviewer-0.1.0/seireitei/components/theme-provider.tsx +72 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/alert.tsx +76 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/badge.tsx +49 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/button.tsx +67 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/card.tsx +103 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/dropdown-menu.tsx +269 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/input.tsx +19 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/label.tsx +24 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/mode-toggle.tsx +40 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/pagination.tsx +129 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/progress.tsx +18 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/select.tsx +192 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/table.tsx +116 -0
- coding_convention_reviewer-0.1.0/seireitei/components/ui/tooltip.tsx +57 -0
- coding_convention_reviewer-0.1.0/seireitei/components.json +25 -0
- coding_convention_reviewer-0.1.0/seireitei/eslint.config.mjs +18 -0
- coding_convention_reviewer-0.1.0/seireitei/hooks/.gitkeep +0 -0
- coding_convention_reviewer-0.1.0/seireitei/hooks/use-scan-ws.ts +90 -0
- coding_convention_reviewer-0.1.0/seireitei/hooks/use-scan.ts +171 -0
- coding_convention_reviewer-0.1.0/seireitei/lib/.gitkeep +0 -0
- coding_convention_reviewer-0.1.0/seireitei/lib/api.ts +109 -0
- coding_convention_reviewer-0.1.0/seireitei/lib/export.ts +16 -0
- coding_convention_reviewer-0.1.0/seireitei/lib/format.ts +19 -0
- coding_convention_reviewer-0.1.0/seireitei/lib/utils.ts +6 -0
- coding_convention_reviewer-0.1.0/seireitei/next.config.mjs +4 -0
- coding_convention_reviewer-0.1.0/seireitei/package-lock.json +11931 -0
- coding_convention_reviewer-0.1.0/seireitei/package.json +42 -0
- coding_convention_reviewer-0.1.0/seireitei/postcss.config.mjs +8 -0
- coding_convention_reviewer-0.1.0/seireitei/public/.gitkeep +0 -0
- coding_convention_reviewer-0.1.0/seireitei/tsconfig.json +33 -0
- coding_convention_reviewer-0.1.0/seireitei/types/global.d.ts +1 -0
- coding_convention_reviewer-0.1.0/seireitei/types/reviewer.ts +29 -0
- coding_convention_reviewer-0.1.0/src/reviewer/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/__main__.py +5 -0
- coding_convention_reviewer-0.1.0/src/reviewer/cli.py +106 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/__init__.py +1 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/config/__init__.py +4 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/config/loader.py +36 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/config/models.py +43 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/engine/__init__.py +5 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/engine/models.py +39 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/engine/registry.py +31 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/engine/runner.py +62 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/engine/suppression.py +30 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/logging.py +29 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/metrics.py +50 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/parser/__init__.py +5 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/parser/base.py +23 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/parser/cache.py +31 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/parser/python_ast.py +20 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/parser/typescript.py +43 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/reporting/__init__.py +4 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/reporting/models.py +44 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/reporting/reporters.py +88 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/scanner.py +57 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/service.py +109 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/storage/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/core/storage/store.py +116 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/__init__.py +1 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/defaults.py +16 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/django/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/django/plugin.py +30 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/django/rules.py +150 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/fastapi/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/fastapi/plugin.py +36 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/fastapi/rules.py +154 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/python/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/python/plugin.py +31 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/python/rules.py +129 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/react/__init__.py +3 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/react/plugin.py +128 -0
- coding_convention_reviewer-0.1.0/src/reviewer/plugins/react/rules.py +597 -0
- coding_convention_reviewer-0.1.0/src/reviewer/server/__init__.py +1 -0
- coding_convention_reviewer-0.1.0/src/reviewer/server/app.py +416 -0
- coding_convention_reviewer-0.1.0/tests/test_cli.py +49 -0
- coding_convention_reviewer-0.1.0/tests/test_config_scanner_reporting.py +61 -0
- coding_convention_reviewer-0.1.0/tests/test_engine_and_plugins.py +212 -0
- coding_convention_reviewer-0.1.0/tests/test_server.py +47 -0
- coding_convention_reviewer-0.1.0/tests/test_service.py +21 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
- package-ecosystem: "npm"
|
|
8
|
+
directory: "/seireitei"
|
|
9
|
+
schedule:
|
|
10
|
+
interval: "weekly"
|
|
11
|
+
- package-ecosystem: "github-actions"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "weekly"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
backend:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
- name: Install system deps
|
|
22
|
+
run: sudo apt-get update && sudo apt-get install -y gcc libffi-dev
|
|
23
|
+
- name: Install package
|
|
24
|
+
run: python -m pip install -e ".[test]"
|
|
25
|
+
- name: Run tests
|
|
26
|
+
run: python -m pytest -v --tb=short
|
|
27
|
+
- name: Run reviewer on itself
|
|
28
|
+
run: reviewer scan src/reviewer/ --json
|
|
29
|
+
|
|
30
|
+
frontend:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
defaults:
|
|
33
|
+
run:
|
|
34
|
+
working-directory: seireitei
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-node@v4
|
|
38
|
+
with:
|
|
39
|
+
node-version: "22"
|
|
40
|
+
cache: "npm"
|
|
41
|
+
cache-dependency-path: seireitei/package-lock.json
|
|
42
|
+
- name: Install dependencies
|
|
43
|
+
run: npm ci
|
|
44
|
+
- name: Type check
|
|
45
|
+
run: npm run typecheck
|
|
46
|
+
- name: Lint
|
|
47
|
+
run: npm run lint
|
|
48
|
+
- name: Build
|
|
49
|
+
run: npm run build
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: PR Review
|
|
2
|
+
on: pull_request
|
|
3
|
+
jobs:
|
|
4
|
+
review:
|
|
5
|
+
runs-on: ubuntu-latest
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/checkout@v4
|
|
8
|
+
with:
|
|
9
|
+
fetch-depth: 0
|
|
10
|
+
- uses: actions/setup-python@v5
|
|
11
|
+
with:
|
|
12
|
+
python-version: "3.12"
|
|
13
|
+
- name: Install system deps
|
|
14
|
+
run: sudo apt-get update && sudo apt-get install -y gcc libffi-dev
|
|
15
|
+
- name: Install reviewer
|
|
16
|
+
run: python -m pip install -e ".[test]"
|
|
17
|
+
- name: Get changed files
|
|
18
|
+
run: git diff origin/${{ github.base_ref }}...HEAD --name-only > changed.txt
|
|
19
|
+
- name: Run reviewer
|
|
20
|
+
run: reviewer scan . --changed-files changed.txt --format github
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
deploy:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-python@v5
|
|
14
|
+
with:
|
|
15
|
+
python-version: "3.12"
|
|
16
|
+
- name: Install build tools
|
|
17
|
+
run: pip install build twine
|
|
18
|
+
- name: Build package
|
|
19
|
+
run: python -m build
|
|
20
|
+
- name: Publish to PyPI
|
|
21
|
+
env:
|
|
22
|
+
TWINE_USERNAME: __token__
|
|
23
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
24
|
+
run: twine upload dist/*
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "2.0.0",
|
|
3
|
+
"tasks": [
|
|
4
|
+
{
|
|
5
|
+
"label": "Backend: API Server",
|
|
6
|
+
"type": "shell",
|
|
7
|
+
"command": "source env/Scripts/activate && python -m reviewer api --port 8766",
|
|
8
|
+
"group": "none",
|
|
9
|
+
"presentation": {
|
|
10
|
+
"panel": "dedicated",
|
|
11
|
+
"group": "backend",
|
|
12
|
+
"reveal": "always"
|
|
13
|
+
},
|
|
14
|
+
"problemMatcher": []
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"label": "Frontend: Dev Server",
|
|
18
|
+
"type": "shell",
|
|
19
|
+
"command": "npm run dev",
|
|
20
|
+
"options": {
|
|
21
|
+
"cwd": "${workspaceFolder}/seireitei"
|
|
22
|
+
},
|
|
23
|
+
"group": "none",
|
|
24
|
+
"presentation": {
|
|
25
|
+
"panel": "dedicated",
|
|
26
|
+
"group": "frontend",
|
|
27
|
+
"reveal": "always"
|
|
28
|
+
},
|
|
29
|
+
"problemMatcher": []
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"label": "Backend: Run Tests",
|
|
33
|
+
"type": "shell",
|
|
34
|
+
"command": "python -m pytest -v",
|
|
35
|
+
"group": {
|
|
36
|
+
"kind": "test",
|
|
37
|
+
"isDefault": true
|
|
38
|
+
},
|
|
39
|
+
"presentation": {
|
|
40
|
+
"panel": "dedicated",
|
|
41
|
+
"reveal": "always"
|
|
42
|
+
},
|
|
43
|
+
"problemMatcher": []
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"label": "Frontend: Type Check",
|
|
47
|
+
"type": "shell",
|
|
48
|
+
"command": "npm run typecheck",
|
|
49
|
+
"options": {
|
|
50
|
+
"cwd": "${workspaceFolder}/seireitei"
|
|
51
|
+
},
|
|
52
|
+
"group": "none",
|
|
53
|
+
"presentation": {
|
|
54
|
+
"panel": "dedicated",
|
|
55
|
+
"group": "frontend",
|
|
56
|
+
"reveal": "always"
|
|
57
|
+
},
|
|
58
|
+
"problemMatcher": ["$tsc"]
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"label": "Frontend: Lint",
|
|
62
|
+
"type": "shell",
|
|
63
|
+
"command": "npm run lint",
|
|
64
|
+
"options": {
|
|
65
|
+
"cwd": "${workspaceFolder}/seireitei"
|
|
66
|
+
},
|
|
67
|
+
"group": "none",
|
|
68
|
+
"presentation": {
|
|
69
|
+
"panel": "dedicated",
|
|
70
|
+
"group": "frontend",
|
|
71
|
+
"reveal": "always"
|
|
72
|
+
},
|
|
73
|
+
"problemMatcher": ["$eslint-stylish"]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"label": "Frontend: Build",
|
|
77
|
+
"type": "shell",
|
|
78
|
+
"command": "npm run build",
|
|
79
|
+
"options": {
|
|
80
|
+
"cwd": "${workspaceFolder}/seireitei"
|
|
81
|
+
},
|
|
82
|
+
"group": {
|
|
83
|
+
"kind": "build",
|
|
84
|
+
"isDefault": false
|
|
85
|
+
},
|
|
86
|
+
"presentation": {
|
|
87
|
+
"panel": "dedicated",
|
|
88
|
+
"reveal": "always"
|
|
89
|
+
},
|
|
90
|
+
"problemMatcher": []
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"label": "Run All: Backend + Frontend",
|
|
94
|
+
"dependsOn": ["Backend: API Server", "Frontend: Dev Server"],
|
|
95
|
+
"dependsOrder": "parallel",
|
|
96
|
+
"group": {
|
|
97
|
+
"kind": "build",
|
|
98
|
+
"isDefault": true
|
|
99
|
+
},
|
|
100
|
+
"presentation": {
|
|
101
|
+
"panel": "dedicated",
|
|
102
|
+
"reveal": "always"
|
|
103
|
+
},
|
|
104
|
+
"problemMatcher": []
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
### Backend (Python)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install in editable mode (required before anything else)
|
|
11
|
+
python -m pip install -e ".[test]"
|
|
12
|
+
|
|
13
|
+
# Run all tests
|
|
14
|
+
python -m pytest
|
|
15
|
+
|
|
16
|
+
# Run a single test file
|
|
17
|
+
python -m pytest tests/test_engine_and_plugins.py
|
|
18
|
+
|
|
19
|
+
# CLI scan
|
|
20
|
+
reviewer scan <path>
|
|
21
|
+
reviewer scan --config reviewer.yaml
|
|
22
|
+
reviewer scan --json
|
|
23
|
+
reviewer scan --format github
|
|
24
|
+
reviewer scan --changed-files changed.txt
|
|
25
|
+
|
|
26
|
+
# Start API server
|
|
27
|
+
reviewer api --port 8766
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Frontend (`seireitei/`)
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
cd seireitei
|
|
34
|
+
npm install
|
|
35
|
+
npm run dev # http://localhost:3000
|
|
36
|
+
npm run build
|
|
37
|
+
npm run lint
|
|
38
|
+
npm run typecheck
|
|
39
|
+
npm run format
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Architecture
|
|
43
|
+
|
|
44
|
+
This is a **deterministic, plugin-based code review engine** with a Python backend and a Next.js dashboard.
|
|
45
|
+
|
|
46
|
+
### Backend: `src/reviewer/`
|
|
47
|
+
|
|
48
|
+
The pipeline for every scan:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
Config (YAML → Pydantic) → Scanner (glob patterns) → Parser (AST)
|
|
52
|
+
→ Rule Engine (per-file) → Suppressions → Findings → Reporter
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Core packages** (`src/reviewer/core/`):
|
|
56
|
+
- `config/` — YAML loading into `ReviewerConfig` / `ScanConfig` / `RuleConfig` Pydantic models
|
|
57
|
+
- `scanner.py` — file discovery via include/exclude globs; also supports a changed-files list for CI
|
|
58
|
+
- `parser/` — protocol-based adapters: `python_ast.py` (stdlib `ast`) and `typescript.py` (tree-sitter); both produce a unified `ParseResult`
|
|
59
|
+
- `engine/` — `PluginRegistry` registers plugins; `runner.py` executes rules against ParseResults; `suppression.py` strips findings covered by `# reviewer: ignore <rule>` or `// reviewer: ignore-file`
|
|
60
|
+
- `reporting/` — `console_report`, `json_report`, `github_report` formatters; `Finding` and `Severity` models
|
|
61
|
+
|
|
62
|
+
**Plugins** (`src/reviewer/plugins/`):
|
|
63
|
+
- `fastapi/` — 9 rules, operates on `.py` files via Python AST parser
|
|
64
|
+
- `react/` — 7 rules, operates on `.ts`/`.tsx` files via tree-sitter parser
|
|
65
|
+
- `defaults.py` — registers both plugins into the default `PluginRegistry`
|
|
66
|
+
|
|
67
|
+
**HTTP API** (`src/reviewer/server/app.py`):
|
|
68
|
+
- `POST /api/scan` — accepts `ScanRequest`, returns `ScanResponse` (findings + summary)
|
|
69
|
+
- `GET /api/health`
|
|
70
|
+
- CORS origin controlled by `ORIGIN` env var (default: `http://localhost:3000`)
|
|
71
|
+
|
|
72
|
+
**CLI** (`src/reviewer/cli.py`): thin Typer wrapper; exit code 1 when findings exist.
|
|
73
|
+
|
|
74
|
+
### Frontend: `seireitei/`
|
|
75
|
+
|
|
76
|
+
Next.js 16 + React 19 + Tailwind CSS 4 + shadcn/ui.
|
|
77
|
+
|
|
78
|
+
- `app/page.tsx` — single-page dashboard (client component); scan form, filters, stats, findings table
|
|
79
|
+
- `hooks/use-scan.ts` — all scan state; calls `lib/api.ts`
|
|
80
|
+
- `lib/api.ts` — POSTs to `${NEXT_PUBLIC_API_URL}/api/scan`; env var lives in `seireitei/.env`
|
|
81
|
+
- `types/reviewer.ts` — shared `Finding`, `ScanResponse`, `ScanSummary`, `Severity` types
|
|
82
|
+
- `components/dashboard/` — `ScanForm`, `FiltersBar`, `StatsGrid`, `StatusBanner`
|
|
83
|
+
- `components/findings/` — `FindingsTable`, `SeverityBadge`
|
|
84
|
+
|
|
85
|
+
The frontend expects the Python API running on `http://127.0.0.1:8766` (set in `seireitei/.env`).
|
|
86
|
+
|
|
87
|
+
### Extending
|
|
88
|
+
|
|
89
|
+
**New rule:** add a function returning `list[Finding]` in the plugin's rules file, register it as a `Rule(...)` in `plugin.py`.
|
|
90
|
+
|
|
91
|
+
**New plugin:** create `src/reviewer/plugins/{name}/plugin.py` with a `create_plugin()` function, implement rules and any parser, register in `plugins/defaults.py`.
|
|
92
|
+
|
|
93
|
+
## Environment Variables
|
|
94
|
+
|
|
95
|
+
| Variable | Where used | Default |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `NEXT_PUBLIC_API_URL` | `seireitei/.env` | `http://127.0.0.1:8766` |
|
|
98
|
+
| `ORIGIN` | API server (CORS) | `http://localhost:3000` |
|
|
99
|
+
|
|
100
|
+
## Suppressions
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
print("x") # reviewer: ignore no_print_statements # inline
|
|
104
|
+
```
|
|
105
|
+
```typescript
|
|
106
|
+
// reviewer: ignore-file // top of file, suppresses all findings
|
|
107
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ── Stage 1: build ───────────────────────────────────────────────────────────
|
|
2
|
+
FROM python:3.12-slim AS builder
|
|
3
|
+
|
|
4
|
+
RUN apt-get update \
|
|
5
|
+
&& apt-get install -y --no-install-recommends gcc libffi-dev \
|
|
6
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
7
|
+
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
COPY pyproject.toml .
|
|
10
|
+
COPY src/ src/
|
|
11
|
+
|
|
12
|
+
RUN pip install --no-cache-dir -e ".[test]"
|
|
13
|
+
|
|
14
|
+
# ── Stage 2: runtime ─────────────────────────────────────────────────────────
|
|
15
|
+
FROM python:3.12-slim AS runtime
|
|
16
|
+
|
|
17
|
+
RUN apt-get update \
|
|
18
|
+
&& apt-get install -y --no-install-recommends curl \
|
|
19
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
20
|
+
|
|
21
|
+
WORKDIR /app
|
|
22
|
+
|
|
23
|
+
# Copy installed packages from builder (includes editable .pth reference to src/)
|
|
24
|
+
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
|
25
|
+
COPY --from=builder /usr/local/bin/reviewer /usr/local/bin/reviewer
|
|
26
|
+
# Editable install resolves imports from /app/src at runtime
|
|
27
|
+
COPY --from=builder /app/src src/
|
|
28
|
+
|
|
29
|
+
EXPOSE 8766
|
|
30
|
+
|
|
31
|
+
HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
|
|
32
|
+
CMD curl -f http://localhost:8766/api/health || exit 1
|
|
33
|
+
|
|
34
|
+
CMD ["reviewer", "api", "--host", "0.0.0.0", "--port", "8766"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coding-convention-reviewer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deterministic, plugin-based coding convention reviewer.
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: cachetools<6,>=5.3
|
|
7
|
+
Requires-Dist: fastapi<1,>=0.115
|
|
8
|
+
Requires-Dist: prometheus-client<1,>=0.20
|
|
9
|
+
Requires-Dist: pydantic<3,>=2.7
|
|
10
|
+
Requires-Dist: python-dotenv<2,>=1.0
|
|
11
|
+
Requires-Dist: pyyaml<7,>=6.0
|
|
12
|
+
Requires-Dist: rich<15,>=13.7
|
|
13
|
+
Requires-Dist: slowapi<1,>=0.1
|
|
14
|
+
Requires-Dist: structlog<26,>=24.0
|
|
15
|
+
Requires-Dist: tree-sitter-typescript<0.24,>=0.20
|
|
16
|
+
Requires-Dist: tree-sitter<0.26,>=0.22
|
|
17
|
+
Requires-Dist: typer<1,>=0.12
|
|
18
|
+
Requires-Dist: uvicorn<1,>=0.30
|
|
19
|
+
Requires-Dist: websockets<15,>=12.0
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: httpx<1,>=0.27; extra == 'test'
|
|
22
|
+
Requires-Dist: pytest<9,>=8.2; extra == 'test'
|