polycheck 0.2.0__py3-none-any.whl
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.
- polycheck/__init__.py +19 -0
- polycheck/cli.py +791 -0
- polycheck/config.py +123 -0
- polycheck/detect.py +151 -0
- polycheck/finding.py +131 -0
- polycheck/initializer.py +333 -0
- polycheck/languages/__init__.py +10 -0
- polycheck/mcp_server.py +994 -0
- polycheck/py.typed +0 -0
- polycheck/registry.py +119 -0
- polycheck/reporters/__init__.py +33 -0
- polycheck/reporters/json_reporter.py +58 -0
- polycheck/reporters/markdown_reporter.py +141 -0
- polycheck/reporters/sarif_reporter.py +114 -0
- polycheck/runner.py +279 -0
- polycheck/session.py +134 -0
- polycheck/tools/__init__.py +10 -0
- polycheck/tools/actionlint.py +66 -0
- polycheck/tools/base.py +449 -0
- polycheck/tools/depcheck.py +96 -0
- polycheck/tools/deptry.py +83 -0
- polycheck/tools/eslint.py +89 -0
- polycheck/tools/gitleaks.py +78 -0
- polycheck/tools/hadolint.py +75 -0
- polycheck/tools/knip.py +84 -0
- polycheck/tools/mypy.py +85 -0
- polycheck/tools/npm_audit.py +74 -0
- polycheck/tools/pip_audit.py +132 -0
- polycheck/tools/ruff.py +80 -0
- polycheck/tools/semgrep.py +80 -0
- polycheck/tools/shellcheck.py +80 -0
- polycheck/tools/sonarless.py +238 -0
- polycheck/tools/tsc.py +77 -0
- polycheck/tools/vulture.py +82 -0
- polycheck/verify.py +288 -0
- polycheck/workflows/__init__.py +76 -0
- polycheck-0.2.0.dist-info/METADATA +614 -0
- polycheck-0.2.0.dist-info/RECORD +42 -0
- polycheck-0.2.0.dist-info/WHEEL +5 -0
- polycheck-0.2.0.dist-info/entry_points.txt +2 -0
- polycheck-0.2.0.dist-info/licenses/LICENSE +21 -0
- polycheck-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,614 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: polycheck
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Polyglot static analysis pipeline that produces LLM-ready triage output
|
|
5
|
+
Author-email: Philip Hofmann <philiphofmann@hotmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Phhofm/polycheck
|
|
8
|
+
Project-URL: Repository, https://github.com/Phhofm/polycheck
|
|
9
|
+
Project-URL: Issues, https://github.com/Phhofm/polycheck/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Phhofm/polycheck/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: static-analysis,lint,linter,triage,llm,code-quality,polyglot,mcp
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: typer>=0.12
|
|
23
|
+
Requires-Dist: rich>=13.0
|
|
24
|
+
Requires-Dist: pyyaml>=6.0
|
|
25
|
+
Requires-Dist: mcp<2,>=1.0
|
|
26
|
+
Requires-Dist: requests>=2.28
|
|
27
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11"
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-mock>=3.10; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.2; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: types-PyYAML; extra == "dev"
|
|
34
|
+
Requires-Dist: types-requests; extra == "dev"
|
|
35
|
+
Requires-Dist: tomli>=2.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# polycheck
|
|
39
|
+
|
|
40
|
+
> **Let your LLM triage a verified report instead of hallucinating a review.**
|
|
41
|
+
> polycheck runs the cheap, exhaustive static-analysis pass first
|
|
42
|
+
> (linters, type-checkers, CVE scanners, secret scanners, SonarQube)
|
|
43
|
+
> and hands the LLM a tight, located, reproducible findings list to
|
|
44
|
+
> adjudicate. The LLM verifies instead of guessing — every finding has
|
|
45
|
+
> a tool, a rule, a file, and a line.
|
|
46
|
+
|
|
47
|
+
> **Self-audit, enforced:** every bundled adapter is guarded by a
|
|
48
|
+
> seeded-defect verifier (`polycheck verify-tools`) — a tool that runs
|
|
49
|
+
> clean on a repo seeded with defects it must catch reports
|
|
50
|
+
> `missed-defects`, never a false "clean bill of health". `polycheck
|
|
51
|
+
> run .` on this repo's own source returns **0 findings at MEDIUM+
|
|
52
|
+
> severity**, and CI re-checks that on every push.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Quick Start: Use `/polycheck` in Kilo Code, OpenCode, Claude Code, and other MCP tools
|
|
57
|
+
|
|
58
|
+
polycheck is designed for LLM coding assistants. Install it once, initialize
|
|
59
|
+
your assistant integration, then run `/polycheck` in any repository.
|
|
60
|
+
|
|
61
|
+
### Step 1: Install polycheck
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pipx install "git+https://github.com/Phhofm/polycheck.git"
|
|
65
|
+
# Once published on PyPI: pipx install polycheck
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Step 2: Initialize `/polycheck`
|
|
69
|
+
|
|
70
|
+
For one setup across all your projects, use global workflow/config files:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
polycheck init --host all --scope global
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Preview first:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
polycheck init --host all --scope global --dry-run
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For a single repository only, use project-local files:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
polycheck init --host all --scope project
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The initializer writes slash-command workflow files and, where safe, MCP
|
|
89
|
+
config:
|
|
90
|
+
|
|
91
|
+
| Host | Project files | Global files |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| Kilo Code | `.kilo/commands/polycheck.md` and `kilo.jsonc` | `~/.config/kilo/commands/polycheck.md` and `~/.config/kilo/kilo.jsonc` |
|
|
94
|
+
| OpenCode | `.opencode/commands/polycheck.md` and `opencode.jsonc` | `~/.config/opencode/commands/polycheck.md` and `~/.config/opencode/opencode.jsonc` |
|
|
95
|
+
| Claude Code | `.claude/skills/polycheck/SKILL.md` and `.mcp.json` | `~/.claude/skills/polycheck/SKILL.md` and `~/.claude.json` |
|
|
96
|
+
|
|
97
|
+
Useful options:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
polycheck init --host kilo,opencode --scope global --yes
|
|
101
|
+
polycheck init --host claude --scope project --force
|
|
102
|
+
polycheck init --host all --scope global --no-mcp
|
|
103
|
+
polycheck init --host all --scope global --mcp-only
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 3: Restart your LLM coding assistant
|
|
107
|
+
|
|
108
|
+
Restart Kilo Code, OpenCode, Claude Code, or your MCP-compatible tool so it
|
|
109
|
+
reloads MCP servers and slash-command files.
|
|
110
|
+
|
|
111
|
+
### Step 4: Run the guided workflow
|
|
112
|
+
|
|
113
|
+
In any project, type:
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
/polycheck
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
or ask your assistant to:
|
|
120
|
+
|
|
121
|
+
```text
|
|
122
|
+
run polycheck
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
What happens:
|
|
126
|
+
|
|
127
|
+
1. The workflow calls the MCP tool `polycheck.run` against the current repo.
|
|
128
|
+
2. polycheck checks which analyzers and system dependencies are available.
|
|
129
|
+
3. If tools are missing, the LLM asks whether to install them.
|
|
130
|
+
4. polycheck runs the installed applicable analyzers.
|
|
131
|
+
5. Reports are written to `polycheck-reports/`.
|
|
132
|
+
6. The LLM shows a compact summary grouped by tool and severity.
|
|
133
|
+
7. If fixable findings exist, the LLM asks before applying fixes.
|
|
134
|
+
8. After fixes, the LLM reruns `polycheck.run` to verify the result.
|
|
135
|
+
9. Once you accept the current state, the LLM suggests `polycheck baseline`;
|
|
136
|
+
later `polycheck.run` calls with `diff: true` surface only new findings.
|
|
137
|
+
10. FALSE-POSITIVE verdicts land in `.polycheck.yml` `suppress:` so they
|
|
138
|
+
are never re-argued.
|
|
139
|
+
|
|
140
|
+
If the MCP tool is unavailable, the generated workflow falls back to:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
polycheck run . --severity MEDIUM
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
and then asks the LLM to triage the generated markdown and JSON reports.
|
|
147
|
+
|
|
148
|
+
Session summaries are written under `.polycheck/` so future LLM sessions
|
|
149
|
+
can reference what was checked, skipped, fixed, or deferred.
|
|
150
|
+
|
|
151
|
+
### Manual MCP setup
|
|
152
|
+
|
|
153
|
+
If you prefer not to use `polycheck init`, configure the MCP server manually.
|
|
154
|
+
|
|
155
|
+
**Claude Code** — add to project `.mcp.json`, `~/.claude/settings.json`, or
|
|
156
|
+
your Claude user MCP config:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"polycheck": {
|
|
162
|
+
"command": "polycheck",
|
|
163
|
+
"args": ["mcp"]
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Kilo Code (VSCode Extension)** — add to `kilo.jsonc` in your project root
|
|
170
|
+
or `~/.config/kilo/kilo.jsonc`:
|
|
171
|
+
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"mcp": {
|
|
175
|
+
"polycheck": {
|
|
176
|
+
"type": "local",
|
|
177
|
+
"command": ["polycheck", "mcp"],
|
|
178
|
+
"enabled": true
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**OpenCode** — add to `opencode.jsonc` in your project root or
|
|
185
|
+
`~/.config/opencode/opencode.jsonc`:
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"mcp": {
|
|
190
|
+
"polycheck": {
|
|
191
|
+
"type": "local",
|
|
192
|
+
"command": ["polycheck", "mcp"],
|
|
193
|
+
"enabled": true
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Any MCP-compatible tool** (generic JSON):
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"mcpServers": {
|
|
204
|
+
"polycheck": {
|
|
205
|
+
"command": "polycheck",
|
|
206
|
+
"args": ["mcp"]
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Docker / SonarQube:** SonarQube analysis through sonarless requires
|
|
213
|
+
both Docker running and the `sonarless` binary installed. polycheck keeps
|
|
214
|
+
sonarless enabled by default when those are available. If Docker is
|
|
215
|
+
missing, polycheck reports it as a skipped system dependency and suggests
|
|
216
|
+
asking your LLM coding assistant for OS-specific Docker setup help. If
|
|
217
|
+
Docker is available but sonarless is missing, the guided MCP workflow
|
|
218
|
+
offers to install sonarless before rerunning `polycheck.run`.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## CLI Usage (Manual)
|
|
223
|
+
|
|
224
|
+
If you prefer running polycheck directly without an LLM:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
polycheck run [PATH] # run all applicable tools
|
|
228
|
+
polycheck run . --tool ruff --tool mypy # restrict to specific tools
|
|
229
|
+
polycheck run . --severity MEDIUM # drop INFO / LOW findings
|
|
230
|
+
polycheck run . --fail-on HIGH # exit 1 if any HIGH/CRITICAL (CI)
|
|
231
|
+
polycheck run . --install # install missing tools, then run
|
|
232
|
+
polycheck run . --parallel # run tools concurrently
|
|
233
|
+
polycheck run . --output markdown # markdown only (no JSON / sarif)
|
|
234
|
+
polycheck baseline . # snapshot current findings
|
|
235
|
+
polycheck run . --diff # only findings NEW since the baseline
|
|
236
|
+
polycheck init --host all --scope global # initialize /polycheck workflows
|
|
237
|
+
polycheck init --dry-run --host all # preview initialization
|
|
238
|
+
polycheck doctor # show installed/missing tools, exit 0 by default
|
|
239
|
+
polycheck doctor --fail-on-missing # exit 1 when tools are missing
|
|
240
|
+
polycheck install # install every missing tool
|
|
241
|
+
polycheck install ruff mypy # install specific tools
|
|
242
|
+
polycheck list-tools # list every available analyzer
|
|
243
|
+
polycheck verify-tools # verify supported analyzers on synthetic repos
|
|
244
|
+
polycheck verify-tools --install --yes # install missing auto-installable tools, then verify
|
|
245
|
+
polycheck verify-tools --include-heavy # include Docker/network-heavy tools
|
|
246
|
+
polycheck prompt --plain # print the triage prompt
|
|
247
|
+
polycheck mcp # start the MCP server
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`polycheck run` exits with code **1** if any finding is at or above
|
|
251
|
+
`--fail-on` (default `MEDIUM`). Use `--fail-on HIGH` in CI.
|
|
252
|
+
|
|
253
|
+
### Verifying every supported analyzer
|
|
254
|
+
|
|
255
|
+
Use `polycheck verify-tools` when changing analyzer wrappers or installer
|
|
256
|
+
logic. It creates synthetic repositories and verifies every registered tool:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
polycheck verify-tools
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Installed tools are run. Missing tools are reported as skipped. To attempt
|
|
263
|
+
automatic installation for installable tools first:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
polycheck verify-tools --install --yes
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Docker/network-heavy tools are skipped by default because they can start
|
|
270
|
+
Docker or reach package registries. Include them explicitly when that is
|
|
271
|
+
acceptable:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
polycheck verify-tools --include-heavy
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
For a full install-and-run verification of every supported analyzer, use:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
polycheck verify-tools --install --yes --include-heavy
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
The heavy set currently includes `sonarless`, `semgrep`, `pip-audit`, and
|
|
284
|
+
`npm-audit`:
|
|
285
|
+
|
|
286
|
+
- `sonarless` requires Docker and the `sonarless` binary. Its installer is
|
|
287
|
+
Docker-aware and only runs when Docker is available.
|
|
288
|
+
- `gitleaks`, `actionlint`, `hadolint`, and `shellcheck` are installed from
|
|
289
|
+
GitHub releases when polycheck can infer the correct OS/architecture asset.
|
|
290
|
+
Unsupported OS/architecture combinations are reported instead of guessed.
|
|
291
|
+
- `semgrep` may download rules when using `--config=auto`.
|
|
292
|
+
- `pip-audit` queries PyPI to audit Python dependencies.
|
|
293
|
+
- `npm-audit` queries the npm registry to audit Node dependencies.
|
|
294
|
+
|
|
295
|
+
To verify every supported tool in the pytest suite, run the heavy marker:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
pytest -m heavy
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
The default `pytest` run includes the heavy smoke test only when the tools are
|
|
302
|
+
already installed or can be skipped safely; use `polycheck verify-tools
|
|
303
|
+
--install --yes --include-heavy` when you explicitly want install-and-run
|
|
304
|
+
coverage for every supported analyzer.
|
|
305
|
+
|
|
306
|
+
### The Triage Prompt
|
|
307
|
+
|
|
308
|
+
The guided MCP workflow handles triage automatically. If you run the CLI
|
|
309
|
+
manually, you can still print the prompt and pair it with a report:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
polycheck prompt --plain # prints just the prompt
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The LLM reads the report (not the source code) and triages each finding
|
|
316
|
+
as REAL BUG, REAL SMELL, FALSE POSITIVE, or DEFERRED.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## MCP Server Reference
|
|
321
|
+
|
|
322
|
+
polycheck ships an MCP server with one primary guided workflow tool,
|
|
323
|
+
`polycheck.run`, plus a compatibility alias and several advanced/low-level
|
|
324
|
+
tools.
|
|
325
|
+
|
|
326
|
+
### Primary tool
|
|
327
|
+
|
|
328
|
+
| Tool | Description |
|
|
329
|
+
|------|-------------|
|
|
330
|
+
| `polycheck.run` | Primary guided workflow: dependency check, optional install approval, scan, reports, coverage metadata, optional baseline diff (`diff: true`), and next action. Do not call `polycheck.doctor` manually for normal runs. |
|
|
331
|
+
| `polycheck` | Compatibility alias for `polycheck.run`. |
|
|
332
|
+
|
|
333
|
+
### Advanced tools
|
|
334
|
+
|
|
335
|
+
| Tool | Description |
|
|
336
|
+
|------|-------------|
|
|
337
|
+
| `polycheck.audit_run` | Run the low-level scan primitive on a repo. Returns report paths, dependency context, and summary. |
|
|
338
|
+
| `polycheck.list_tools` | List every analyzer polycheck knows about and whether it is installed. |
|
|
339
|
+
| `polycheck.explain_finding` | Explain a category (CVE, SECURITY, LINT, etc.) and how to triage it. |
|
|
340
|
+
| `polycheck.doctor` | Check Docker, sonarless, and all analyzers. Non-fatal by default. |
|
|
341
|
+
| `polycheck.install` | Install missing tools (all or specific ones). |
|
|
342
|
+
|
|
343
|
+
### Resources
|
|
344
|
+
|
|
345
|
+
| Resource | Description |
|
|
346
|
+
|----------|-------------|
|
|
347
|
+
| `polycheck://session/latest` | Latest `polycheck.run` workflow summary. |
|
|
348
|
+
| `polycheck://triage/prompt` | The interactive LLM triage prompt. |
|
|
349
|
+
| `polycheck://findings/markdown` | Last run's markdown report. |
|
|
350
|
+
| `polycheck://findings/json` | Last run's JSON report. |
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## What You Get
|
|
355
|
+
|
|
356
|
+
`polycheck run <repo>` writes a `<repo>/polycheck-reports/` directory:
|
|
357
|
+
|
|
358
|
+
* `polycheck-report.md` — human-friendly, LLM-friendly triage report
|
|
359
|
+
* `polycheck-report.json` — canonical machine-readable findings
|
|
360
|
+
* `polycheck-report.sarif` — IDE / GitHub code-scanning integration
|
|
361
|
+
|
|
362
|
+
Each finding has a stable schema:
|
|
363
|
+
|
|
364
|
+
```json
|
|
365
|
+
{
|
|
366
|
+
"tool": "sonarless",
|
|
367
|
+
"rule": "sonar:bug:S3776",
|
|
368
|
+
"severity": "HIGH",
|
|
369
|
+
"category": "security",
|
|
370
|
+
"message": "Complexity of this function is too high",
|
|
371
|
+
"file": "src/parser.py",
|
|
372
|
+
"line": 42,
|
|
373
|
+
"fixable": false
|
|
374
|
+
}
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Configuration
|
|
380
|
+
|
|
381
|
+
Drop a `.polycheck.yml` (or `.polycheck.toml`) at the repo root:
|
|
382
|
+
|
|
383
|
+
```yaml
|
|
384
|
+
enable: # only run these tools (default: all applicable)
|
|
385
|
+
- ruff
|
|
386
|
+
- mypy
|
|
387
|
+
- gitleaks
|
|
388
|
+
- sonarless
|
|
389
|
+
disable: # never run these tools
|
|
390
|
+
- pylint
|
|
391
|
+
severity_threshold: MEDIUM
|
|
392
|
+
timeout: 600 # per-tool seconds
|
|
393
|
+
output:
|
|
394
|
+
formats: [markdown, json, sarif]
|
|
395
|
+
report_dir: polycheck-reports
|
|
396
|
+
extra_args: # per-tool extra CLI args
|
|
397
|
+
ruff: ["--select", "E,F"]
|
|
398
|
+
eslint: ["--max-warnings", "0"]
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**sonarless** is enabled by default when Docker is running and the
|
|
402
|
+
`sonarless` binary is installed. Disable it with:
|
|
403
|
+
|
|
404
|
+
```yaml
|
|
405
|
+
disable:
|
|
406
|
+
- sonarless
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Baseline & durable suppressions
|
|
410
|
+
|
|
411
|
+
The daily loop: run once, triage, snapshot — then only *new* code
|
|
412
|
+
produces findings.
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
polycheck baseline . # snapshot today's accepted findings
|
|
416
|
+
polycheck run . --diff # report only NEW findings (exit 1 gates on new ones)
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
The baseline stores fingerprints only (tool, rule, file, line,
|
|
420
|
+
column) in `polycheck-reports/polycheck-baseline.json` — small, stable
|
|
421
|
+
across message changes. Re-run `polycheck baseline` after fixing or
|
|
422
|
+
triaging to move the needle forward.
|
|
423
|
+
|
|
424
|
+
When the LLM (or you) classifies a finding as FALSE POSITIVE, persist
|
|
425
|
+
that verdict so it is never re-argued:
|
|
426
|
+
|
|
427
|
+
```yaml
|
|
428
|
+
suppress:
|
|
429
|
+
- F401 # suppress rule everywhere
|
|
430
|
+
- SC2086@scripts/legacy.sh # suppress rule in one file only
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Suppressed findings are dropped before reports are written and before
|
|
434
|
+
the CI exit-code gate, so they never reappear in a later run.
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## Tool Matrix
|
|
439
|
+
|
|
440
|
+
| Language / Surface | Tool | What it does |
|
|
441
|
+
|--------------------|-----------------|-----------------------------------------|
|
|
442
|
+
| Python | ruff | Fast linter + import sort |
|
|
443
|
+
| Python | mypy | Static type checker |
|
|
444
|
+
| Python | vulture | Dead code (with whitelist support) |
|
|
445
|
+
| Python | pip-audit | CVE scan in dependencies |
|
|
446
|
+
| Python | deptry | Missing / unused dependencies |
|
|
447
|
+
| JS / TS | eslint | Linter (ESLint v9 flat config + legacy) |
|
|
448
|
+
| JS / TS | tsc | TypeScript type checker |
|
|
449
|
+
| JS / TS | knip | Unused files, exports, dependencies |
|
|
450
|
+
| JS / TS | npm-audit | CVE scan in dependencies |
|
|
451
|
+
| JS / TS | depcheck | Missing / unused dependencies |
|
|
452
|
+
| Universal | gitleaks | Secrets in the working tree |
|
|
453
|
+
| Universal | semgrep | Pattern-based security (multi-language) |
|
|
454
|
+
| Universal | **sonarless** | **SonarQube: bugs, vulns, code smells (30+ languages, requires Docker)** |
|
|
455
|
+
| GitHub Actions | actionlint | Workflow file linter |
|
|
456
|
+
| Shell | shellcheck | Shell script linter |
|
|
457
|
+
| Docker | hadolint | Dockerfile linter |
|
|
458
|
+
|
|
459
|
+
Install hints are exposed via `polycheck explain <tool>`.
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## How It Works
|
|
464
|
+
|
|
465
|
+
```
|
|
466
|
+
┌────────────────────────────────────────────┐
|
|
467
|
+
│ polycheck.run │
|
|
468
|
+
└─────────────────────┬──────────────────────┘
|
|
469
|
+
│
|
|
470
|
+
dependency check → install approval → detect → filter → run → dedupe → group
|
|
471
|
+
│
|
|
472
|
+
┌────────────┬─────────────┬───────┴────────┬──────────────┐
|
|
473
|
+
│ Python │ JS / TS │ Universal │ Polyglot │
|
|
474
|
+
│ ruff │ eslint │ gitleaks │ semgrep │
|
|
475
|
+
│ mypy │ tsc │ **sonarless** │ │
|
|
476
|
+
│ vulture │ knip │ │ │
|
|
477
|
+
│ pip-audit │ npm-audit │ │ │
|
|
478
|
+
│ deptry │ depcheck │ │ │
|
|
479
|
+
└────────────┴─────────────┴────────────────┴──────────────┘
|
|
480
|
+
│
|
|
481
|
+
normalize → Finding
|
|
482
|
+
│
|
|
483
|
+
┌───────────────────┼───────────────────┐
|
|
484
|
+
markdown json sarif
|
|
485
|
+
(LLM-friendly) (canonical) (IDE / GH code-scanning)
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
Every analyzer is wrapped by a `Tool` adapter in
|
|
489
|
+
`src/polycheck/tools/`. Each adapter:
|
|
490
|
+
|
|
491
|
+
1. Calls the underlying tool as a subprocess.
|
|
492
|
+
2. Parses its output (JSON or text, with format-specific regexes).
|
|
493
|
+
3. Emits `Finding` objects with a stable schema.
|
|
494
|
+
|
|
495
|
+
A finding has a `fingerprint` of
|
|
496
|
+
`(tool, rule, file, line, column)`, so two tools reporting the same
|
|
497
|
+
defect converge to one row.
|
|
498
|
+
|
|
499
|
+
### sonarless (Docker-based)
|
|
500
|
+
|
|
501
|
+
sonarless starts a local SonarQube instance in Docker, scans your code,
|
|
502
|
+
and queries the SonarQube API for per-file issues. It covers 30+
|
|
503
|
+
languages for bugs, vulnerabilities, code smells, and security hotspots.
|
|
504
|
+
|
|
505
|
+
- Requires **Docker** installed and running
|
|
506
|
+
- Install when Docker is available: `curl -sSL https://raw.githubusercontent.com/gitricko/sonarless/main/install.sh | bash`
|
|
507
|
+
- The guided MCP workflow offers to install sonarless automatically when Docker is available.
|
|
508
|
+
- Web UI: `http://localhost:9234` (admin/Son@rless123)
|
|
509
|
+
- Clean up: `sonarless docker-clean`
|
|
510
|
+
|
|
511
|
+
**PATH setup:** After installing sonarless, add it to your PATH:
|
|
512
|
+
|
|
513
|
+
```bash
|
|
514
|
+
# Add to ~/.bashrc or ~/.zshrc
|
|
515
|
+
export PATH="$HOME/.sonarless:$PATH"
|
|
516
|
+
|
|
517
|
+
# Or create a wrapper script
|
|
518
|
+
echo '#!/bin/bash
|
|
519
|
+
exec $HOME/.sonarless/makefile.sh "$@"' > $HOME/.sonarless/sonarless
|
|
520
|
+
chmod +x $HOME/.sonarless/sonarless
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
**Note for OpenCode users:** If you're using OpenCode in a sandboxed
|
|
524
|
+
environment, Docker may not be accessible due to snap confinement.
|
|
525
|
+
Install Docker via apt (`sudo apt install docker.io`) instead of snap
|
|
526
|
+
for full compatibility.
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## Adding a Language or Tool
|
|
531
|
+
|
|
532
|
+
Adding a new analyzer is a single file:
|
|
533
|
+
|
|
534
|
+
```python
|
|
535
|
+
# src/polycheck/tools/mypy_advanced.py
|
|
536
|
+
from ..finding import Category, Severity
|
|
537
|
+
from .base import Tool
|
|
538
|
+
|
|
539
|
+
class MypyAdvancedTool(Tool):
|
|
540
|
+
name = "mypy-advanced"
|
|
541
|
+
category = Category.TYPE
|
|
542
|
+
languages = ["python"]
|
|
543
|
+
|
|
544
|
+
def is_applicable(self, repo):
|
|
545
|
+
return (repo / "pyproject.toml").exists()
|
|
546
|
+
|
|
547
|
+
def run(self, repo):
|
|
548
|
+
# call subprocess, parse output, return list[Finding]
|
|
549
|
+
...
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
`ToolRegistry.discover()` will auto-register it on first import. No
|
|
553
|
+
core changes required.
|
|
554
|
+
|
|
555
|
+
To add a new **language** (e.g. Go, Rust), add a marker to the
|
|
556
|
+
`LANGUAGES` tuple in `src/polycheck/detect.py`, and existing tools
|
|
557
|
+
that already speak the language (e.g. semgrep, gitleaks) will pick it
|
|
558
|
+
up automatically. New language-specific tools just set
|
|
559
|
+
`languages = ["go"]`.
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Origin
|
|
564
|
+
|
|
565
|
+
polycheck started because a coworker pasted this prompt into Claude Code
|
|
566
|
+
for two projects:
|
|
567
|
+
|
|
568
|
+
> *"Go bug hunting, carefully analyze the entire code. Create a list of
|
|
569
|
+
> bugs and errors. Sort by critical to minor. Max 20 items."*
|
|
570
|
+
|
|
571
|
+
It burned through a massive amount of tokens and produced very little
|
|
572
|
+
useful outcome. The LLM was re-reading code that existing tools already
|
|
573
|
+
analyze faster and more reliably.
|
|
574
|
+
|
|
575
|
+
That's when it clicked: **there's a more efficient way to use LLMs.**
|
|
576
|
+
Static analyzers already do the cheap, exhaustive pass — linting, type
|
|
577
|
+
checking, CVE scanning, secret detection. Give the LLM the structured
|
|
578
|
+
report from those tools, and it can focus on triage and verification
|
|
579
|
+
instead of re-reading everything from scratch.
|
|
580
|
+
|
|
581
|
+
We need to learn to *combine* new technology with established tools,
|
|
582
|
+
not replace the old with the new. It reminds me of the blockchain hype
|
|
583
|
+
during university — everyone wanted to use it as a distributed database
|
|
584
|
+
when highly optimized systems already existed for that. The same pattern
|
|
585
|
+
is repeating with LLMs: they're not the solution for *everything*.
|
|
586
|
+
Sometimes the right answer is a thin wrapper that connects tools that
|
|
587
|
+
already work.
|
|
588
|
+
|
|
589
|
+
polycheck is that wrapper. It doesn't try to understand your code. It
|
|
590
|
+
lets your linters do what they're good at, and hands the LLM a tight
|
|
591
|
+
report to act on.
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Philosophy
|
|
596
|
+
|
|
597
|
+
* **Static analyzers are cheap; reading code is expensive.**
|
|
598
|
+
polycheck does the cheap pass exhaustively.
|
|
599
|
+
* **One schema, many backends.** Every analyzer maps to
|
|
600
|
+
`Finding`. Reporters only know one shape.
|
|
601
|
+
* **LLMs are a second pass, not a substitute.** polycheck
|
|
602
|
+
doesn't call any model. It produces the artifacts that make an
|
|
603
|
+
LLM's review step fast and focused.
|
|
604
|
+
* **No magic.** polycheck is a thin subprocess wrapper. It
|
|
605
|
+
doesn't try to *understand* your code. Your linters already
|
|
606
|
+
do that better than any LLM would.
|
|
607
|
+
* **Reports are git-tracked.** `polycheck-reports/` is plain
|
|
608
|
+
text. Diff it across PRs.
|
|
609
|
+
|
|
610
|
+
---
|
|
611
|
+
|
|
612
|
+
## License
|
|
613
|
+
|
|
614
|
+
MIT.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
polycheck/__init__.py,sha256=29V3yoYMtNyUdg4tPWp1-T7y-yzZZxHzhAnjCYR7Mn4,747
|
|
2
|
+
polycheck/cli.py,sha256=9G9GXgTJeb4WQdx07kpW7ZNPlfEdfyEV6WWC9HCG_tY,25433
|
|
3
|
+
polycheck/config.py,sha256=B7_b6ryJJRbe-r5P9K-ro4V-NQPnlsUtZ2E2GW--E3s,4224
|
|
4
|
+
polycheck/detect.py,sha256=jqiF78P2_B8rpj3Uhkb4SbOIln9FoFsoGRPZjQuYvuM,5258
|
|
5
|
+
polycheck/finding.py,sha256=MehocouCNiq1ag7Z8R_900VkZjyZqIKH7zAzCeV-i1c,4648
|
|
6
|
+
polycheck/initializer.py,sha256=TFHdu4Ir0tlS8qcTCz33AazclTNSXYDi3vF45ejYIZQ,9546
|
|
7
|
+
polycheck/mcp_server.py,sha256=4ZIS4Y_lzsGrVso2NmPnDKvaFmmGnjtvWdgSAJ0B4Ro,36234
|
|
8
|
+
polycheck/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
polycheck/registry.py,sha256=9z2T_QuEfoBUZgijCMQZaoCS3Yj2XpRuV5D9xc3RDXQ,4394
|
|
10
|
+
polycheck/runner.py,sha256=J7VvokE_CZ_kCq79jjNVJja7vjaapuHHxA6_oLHaDhE,9897
|
|
11
|
+
polycheck/session.py,sha256=95auQYRdfgfHmR7cyNxk6tVmMAhcTL7N8JVqWQ_f2Ek,4450
|
|
12
|
+
polycheck/verify.py,sha256=y45qhv9bL-jdcaeDWIqlNABpKSrIK0WQRLSFGcRvCT0,8721
|
|
13
|
+
polycheck/languages/__init__.py,sha256=bJO1MfhcuIOBIqNEWSDRDErQYdP2679dGLiZYIyJgDk,399
|
|
14
|
+
polycheck/reporters/__init__.py,sha256=hiZA_SOA7W01NwbcnQJSzbPvPYZm9QxocmGbo0zx-Z0,759
|
|
15
|
+
polycheck/reporters/json_reporter.py,sha256=M7eM9L72BrwiRDNzvyAe8R8xacujDFYgV9JbvKS35_Y,1784
|
|
16
|
+
polycheck/reporters/markdown_reporter.py,sha256=eawwoR0SN9mf7vTyRXaH35c4P3gPuqcTBkIJf3nrpb4,4521
|
|
17
|
+
polycheck/reporters/sarif_reporter.py,sha256=XLIrg85QpV3tjyyzPJ39OA72XyWnWj-Y0F-ycgdpRUU,3307
|
|
18
|
+
polycheck/tools/__init__.py,sha256=-3KycjmjWmBEcpH0mYpcu0rTR1tS0OqMo8JO9kiGTLs,280
|
|
19
|
+
polycheck/tools/actionlint.py,sha256=2zYHT0L0xrw3DhyD57ZJsQmv-ajLqGrt5diale2BAnw,2127
|
|
20
|
+
polycheck/tools/base.py,sha256=CF7bhdTzIPcCGl-lDEqDBIjX0PAflo6Fnhuc3Q6Em3I,17880
|
|
21
|
+
polycheck/tools/depcheck.py,sha256=MK6umN096pEC9BJplW24pr1mIDppCq4KF7DePwuMZBY,3519
|
|
22
|
+
polycheck/tools/deptry.py,sha256=SOpI4GmhnrH8e7UWilTjRj1O6-AdiFHWBT12phn4qsg,2919
|
|
23
|
+
polycheck/tools/eslint.py,sha256=JBlMrUFsn92GOW0cSzB_hLSv_Upyr4qfRvSFx9iL0hA,3397
|
|
24
|
+
polycheck/tools/gitleaks.py,sha256=pwGdFfH0luF2gs1TRjAdbnSN-5uSDLHHM2ZrhBFRvuQ,2950
|
|
25
|
+
polycheck/tools/hadolint.py,sha256=-nhZi-K9b7zVVy-HOrV_tdwbay85ud6JcA834OhCsks,2559
|
|
26
|
+
polycheck/tools/knip.py,sha256=ttzTwUQw7yvkcN7TqjPLIi4zoGPgWiM_2EajPccdpTI,3187
|
|
27
|
+
polycheck/tools/mypy.py,sha256=Mop7OFhKQVyzGmVTGw0cdsk8SByTEFvK-Vc_VfkDtGo,3178
|
|
28
|
+
polycheck/tools/npm_audit.py,sha256=HWJZKrpazJJ1LfE7o6R7R7aG8fHJk2bFV8B_jadwOUA,2497
|
|
29
|
+
polycheck/tools/pip_audit.py,sha256=Htmd-RMeuS-7Y7yDFBb8_vAPr8tnx0HxybxG8dAfMFo,4514
|
|
30
|
+
polycheck/tools/ruff.py,sha256=bI7SPrOatnsnOa4qNCbJPPdgSlpGaarmyNUET0N5J7c,2835
|
|
31
|
+
polycheck/tools/semgrep.py,sha256=djMM3ZNoJDim6p6fa9qyiPfG6QMg4Je6FItJ7LQjiYk,2644
|
|
32
|
+
polycheck/tools/shellcheck.py,sha256=VA5xmY2HdpB4WqcF5ir6Wle1r9G8zPrBwYNBWNiZWsA,2745
|
|
33
|
+
polycheck/tools/sonarless.py,sha256=vVi84u6m30dDyjjB7MV1iGTTU7xVaT-Bp8KM2HzQ7wA,8204
|
|
34
|
+
polycheck/tools/tsc.py,sha256=DOt0gstUwVn-VKX5DSWeuekGFDAh4OIXJrEfomeAtFE,2482
|
|
35
|
+
polycheck/tools/vulture.py,sha256=iIriE9wz8Vl25B5PMLJgl-52lyZntLMo4T1ei1Unb9g,2819
|
|
36
|
+
polycheck/workflows/__init__.py,sha256=CfK5AuzYHFN9fPEZKvV-lgXRz9BUGSWpd-y302spkAo,2574
|
|
37
|
+
polycheck-0.2.0.dist-info/licenses/LICENSE,sha256=0W1NB_1SS_X7Yz5md63uVkz-z8vUnfGHDuyUYzSBX1A,1071
|
|
38
|
+
polycheck-0.2.0.dist-info/METADATA,sha256=R1o-qppjUYAzhTRUigGU39YAuXvGj9GbhlY-K9dLKj4,22156
|
|
39
|
+
polycheck-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
40
|
+
polycheck-0.2.0.dist-info/entry_points.txt,sha256=d92V5wcipkPh50Ax6Sxi0NrbGexzkMgwC0Fjm5jmZEM,49
|
|
41
|
+
polycheck-0.2.0.dist-info/top_level.txt,sha256=FZNEoRDYp1Ks5WekT4HNS7FkVgZ0ihfpMmh1pvc_7oQ,10
|
|
42
|
+
polycheck-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Philip Hofmann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
polycheck
|