doc-ai-slopcheck 1.2.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.
- doc_ai_slopcheck-1.2.0/LICENSE +21 -0
- doc_ai_slopcheck-1.2.0/PKG-INFO +217 -0
- doc_ai_slopcheck-1.2.0/README.md +188 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/__init__.py +5 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/__main__.py +4 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/cli.py +429 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/config.py +692 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/api_routes.py +209 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/context_filter.py +179 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/duplication.py +149 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/repo_files.py +78 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/scanner.py +175 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/engine/suppression.py +68 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/github/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/github/pr_context.py +22 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/models.py +60 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/output/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/output/annotations.py +45 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/output/html_report.py +175 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/output/markdown_summary.py +52 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/output/sarif.py +91 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/parsers/__init__.py +5 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/parsers/treesitter.py +187 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/base.py +70 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/_manifest.py +123 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/ai_conversational_bleed.py +107 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/ai_hardcoded_mocks.py +107 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/ai_identity_refusal.py +92 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/ai_instruction_comment.py +77 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/api_contract_breaking.py +166 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/assignment_in_conditional.py +75 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/bare_except_pass.py +100 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/bare_except_pass_go.py +109 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/bare_except_pass_js.py +108 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/break_in_nested_loop.py +183 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/collection_modify_while_iterating.py +122 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/console_log_in_production.py +97 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/contradictory_null_check.py +169 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/cross_language_idiom.py +152 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/dangerous_shell_in_markdown.py +89 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/dead_code_comment.py +141 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/debug_code_left.py +71 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/deep_inheritance.py +103 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/deep_nesting.py +107 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/division_by_zero_risk.py +58 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/early_return_opportunity.py +99 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/global_state_leak.py +110 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/go_error_wrap_missing_w.py +63 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/go_ignored_error.py +90 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/go_missing_defer.py +73 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/goto_usage.py +52 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/hallucinated_placeholder.py +117 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/hardcoded_secret.py +134 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/idor_risk.py +136 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/incomplete_error_message.py +76 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/insecure_default.py +98 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_await_in_loop.py +79 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_dangerously_set_html.py +54 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_json_parse_unguarded.py +87 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_loose_equality.py +71 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_timer_no_cleanup.py +79 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/js_unhandled_promise.py +64 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/large_anonymous_function.py +80 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/large_file.py +57 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/large_function.py +163 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/lock_without_release.py +150 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/many_positional_args.py +158 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/missing_default_branch.py +170 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/multiple_classes_per_file.py +85 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/obfuscated_code.py +108 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/obvious_perf_drain.py +128 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/oversized_class.py +215 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/param_reassignment.py +147 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/placeholder_tokens.py +86 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/plan_reference_comment.py +111 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/python_mutable_default.py +57 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/react_async_useeffect.py +53 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/react_index_key.py +57 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/recursion_without_limit.py +136 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/redundant_sql_index.py +97 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/regex_dos.py +171 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/select_star_sql.py +60 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/short_variable_name.py +77 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/sql_string_concat.py +146 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/stale_comment.py +87 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/stub_function_body.py +173 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/stub_function_body_go.py +140 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/stub_function_body_js.py +191 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/thread_unsafe_global.py +109 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/typescript_any_abuse.py +95 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/undeclared_import.py +219 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/unreachable_code_after_return.py +114 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/unused_suppression.py +37 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/use_after_free.py +88 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/weak_function_name.py +204 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/generic/weak_hash.py +81 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/registry.py +174 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/repo/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/rules/repo/forbidden_import_edges.py +106 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/state/__init__.py +1 -0
- doc_ai_slopcheck-1.2.0/doc_ai_slopcheck/state/store.py +26 -0
- doc_ai_slopcheck-1.2.0/pyproject.toml +66 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Euraika
|
|
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,217 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: doc-ai-slopcheck
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: Deterministic scanner for AI-style code failures. 73 rules for Python, JS/TS, Go, C/C++, SQL.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: static-analysis,linter,ai-code,code-quality,security,github-actions
|
|
8
|
+
Author: Euraika
|
|
9
|
+
Author-email: info@euraika.net
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
16
|
+
Classifier: Topic :: Software Development :: Testing
|
|
17
|
+
Provides-Extra: ast
|
|
18
|
+
Provides-Extra: github
|
|
19
|
+
Requires-Dist: PyYAML (>=6.0)
|
|
20
|
+
Requires-Dist: pydantic (>=2.8)
|
|
21
|
+
Requires-Dist: requests (>=2.32) ; extra == "github"
|
|
22
|
+
Requires-Dist: tree-sitter (>=0.23) ; extra == "ast"
|
|
23
|
+
Requires-Dist: typer (>=0.12)
|
|
24
|
+
Project-URL: Homepage, https://github.com/Digitalist-Open-Cloud/AI-Slopcheck
|
|
25
|
+
Project-URL: Issues, https://github.com/Digitalist-Open-Cloud/AI-Slopcheck/issues
|
|
26
|
+
Project-URL: Repository, https://github.com/Digitalist-Open-Cloud/AI-Slopcheck
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# doc-ai-slopcheck
|
|
30
|
+
|
|
31
|
+
[](LICENSE)
|
|
32
|
+
[]()
|
|
33
|
+
|
|
34
|
+
**Deterministic scanner for AI-style code failures. 73 rules. No LLM. No backend.**
|
|
35
|
+
|
|
36
|
+
Digitalist fork of [ai-slopcheck](https://github.com/Euraika-Labs/ai_slopcheck) by Euraika, which is no longer published.
|
|
37
|
+
|
|
38
|
+
> Catches the mistakes AI coding assistants leave behind — stub functions, silent error handling, hallucinated placeholders, hardcoded secrets, and 68 more patterns across Python, JS/TS, Go, C/C++, SQL, and Markdown.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Scan a project
|
|
52
|
+
doc-ai-slopcheck scan . --output findings.json --fail-on warning
|
|
53
|
+
|
|
54
|
+
# View results
|
|
55
|
+
doc-ai-slopcheck summary findings.json
|
|
56
|
+
|
|
57
|
+
# GitHub Security tab (SARIF)
|
|
58
|
+
doc-ai-slopcheck sarif findings.json
|
|
59
|
+
|
|
60
|
+
# Only scan changed files (CI)
|
|
61
|
+
doc-ai-slopcheck scan . --changed-files git --fail-on warning
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## What It Catches
|
|
65
|
+
|
|
66
|
+
| Category | Rules | Examples |
|
|
67
|
+
|----------|:-----:|---------|
|
|
68
|
+
| **AI Detection** | 16 | Stub functions, instruction comments, plan/task IDs in comments, conversational bleed, identity refusals |
|
|
69
|
+
| **Security** | 7 | Hardcoded secrets, SQL injection, XSS, weak hashing, obfuscated code |
|
|
70
|
+
| **JavaScript / Node** | 11 | await-in-loop, unguarded JSON.parse, loose equality, React antipatterns |
|
|
71
|
+
| **Go** | 3 | Ignored errors, missing defer, wrong error wrapping |
|
|
72
|
+
| **Python** | 1 | Mutable default arguments |
|
|
73
|
+
| **Cross-Language** | 17 | Debug code, unreachable code, deep inheritance, dangerous shell in markdown |
|
|
74
|
+
| **Data-Flow** | 4 | Contradictory null checks, lock safety, IDOR risk, thread-unsafe globals |
|
|
75
|
+
| **Quality** | 9 | Large functions (>150 lines), copy-pasted code across files, plus opt-in deep nesting |
|
|
76
|
+
| **API Contract** | 1 | Removed routes, deprecated endpoints |
|
|
77
|
+
| **Repo-Specific** | 1 | Import boundary violations |
|
|
78
|
+
| **Meta** | 1 | Unused suppression directives |
|
|
79
|
+
|
|
80
|
+
## Features
|
|
81
|
+
|
|
82
|
+
- **73 deterministic rules** — no LLM, no network, no randomness
|
|
83
|
+
- **6 languages** — Python, JS/TS, Go, C/C++, SQL, Markdown
|
|
84
|
+
- **Inline suppression** — `# slopcheck: ignore[rule_id]`, or `# slopcheck: ignore-next[duplicate_code]` above a copied block
|
|
85
|
+
- **SARIF output** — integrates with GitHub Security tab
|
|
86
|
+
- **HTML report** — standalone, shareable page (`doc-ai-slopcheck html findings.json > report.html`)
|
|
87
|
+
- **Diff-only mode** — scan only changed files (`--changed-files git`)
|
|
88
|
+
- **Baselines** — suppress existing findings, fail only on new ones
|
|
89
|
+
- **API snapshots** — detect removed API routes
|
|
90
|
+
- **Tree-sitter** — optional AST context for better precision
|
|
91
|
+
- **Threaded** — multi-core scanning (`--jobs N`)
|
|
92
|
+
- **Confidence filtering** — `--min-confidence medium` for high-signal-only mode
|
|
93
|
+
|
|
94
|
+
## GitHub Actions
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
name: slopcheck
|
|
98
|
+
on: [pull_request]
|
|
99
|
+
jobs:
|
|
100
|
+
scan:
|
|
101
|
+
runs-on: ubuntu-latest
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
- uses: actions/setup-python@v5
|
|
105
|
+
with: { python-version: '3.12' }
|
|
106
|
+
- run: pip install git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git
|
|
107
|
+
- run: doc-ai-slopcheck scan . --output findings.json --fail-on warning
|
|
108
|
+
- run: doc-ai-slopcheck github-annotations findings.json
|
|
109
|
+
- run: doc-ai-slopcheck sarif findings.json > results.sarif
|
|
110
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
111
|
+
with: { sarif_file: results.sarif }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Baselines (Incremental Adoption)
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# First run: baseline existing findings
|
|
118
|
+
doc-ai-slopcheck scan . --output findings.json --fail-on none
|
|
119
|
+
doc-ai-slopcheck create-baseline findings.json
|
|
120
|
+
|
|
121
|
+
# CI: only fail on NEW findings
|
|
122
|
+
doc-ai-slopcheck scan . --baseline .slopcheck/baseline.json --fail-on warning
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## CLI Reference
|
|
126
|
+
|
|
127
|
+
| Command | Purpose |
|
|
128
|
+
|---------|---------|
|
|
129
|
+
| `doc-ai-slopcheck scan [paths]` | Scan files, write findings JSON |
|
|
130
|
+
| `doc-ai-slopcheck summary <file>` | Markdown summary |
|
|
131
|
+
| `doc-ai-slopcheck github-annotations <file>` | GitHub workflow annotations |
|
|
132
|
+
| `doc-ai-slopcheck sarif <file>` | SARIF v2.1.0 output |
|
|
133
|
+
| `doc-ai-slopcheck html <file> > report.html` | Standalone HTML report |
|
|
134
|
+
| `doc-ai-slopcheck create-baseline <file>` | Create fingerprint baseline |
|
|
135
|
+
| `doc-ai-slopcheck api-snapshot` | Snapshot API routes for contract checks |
|
|
136
|
+
|
|
137
|
+
### Key `scan` Options
|
|
138
|
+
|
|
139
|
+
| Option | Default | Description |
|
|
140
|
+
|--------|---------|-------------|
|
|
141
|
+
| `--fail-on` | `error` | Exit 1 at severity: `none` / `note` / `warning` / `error` |
|
|
142
|
+
| `--min-confidence` | `low` | Filter: `low` / `medium` / `high` |
|
|
143
|
+
| `--baseline` | — | Suppress fingerprints from baseline file |
|
|
144
|
+
| `--changed-files` | — | `git` or `@file.txt` for diff-only mode |
|
|
145
|
+
| `--jobs` | auto | Thread count (0=auto, 1=sequential) |
|
|
146
|
+
| `--api-baseline` | — | API snapshot for contract comparison |
|
|
147
|
+
|
|
148
|
+
## Configuration
|
|
149
|
+
|
|
150
|
+
Create `.slopcheck/config.yaml` (or `.slopcheck.yaml`):
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
rules:
|
|
154
|
+
# Disable a rule
|
|
155
|
+
js_loose_equality:
|
|
156
|
+
enabled: false
|
|
157
|
+
|
|
158
|
+
# Enable an opt-in rule with custom threshold
|
|
159
|
+
deep_nesting:
|
|
160
|
+
enabled: true
|
|
161
|
+
max_depth: 5
|
|
162
|
+
|
|
163
|
+
# Configure detection
|
|
164
|
+
hallucinated_placeholder:
|
|
165
|
+
allowed_domains: ["example.com", "localhost"]
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Tree-sitter (Optional)
|
|
169
|
+
|
|
170
|
+
For better precision (~5% improvement on string/comment context detection):
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pip install "doc-ai-slopcheck[ast] @ git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git"
|
|
174
|
+
# Or manually:
|
|
175
|
+
pip install tree-sitter-python tree-sitter-javascript tree-sitter-go tree-sitter-typescript
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Project Layout
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
doc_ai_slopcheck/
|
|
182
|
+
├── cli.py — 6 CLI commands
|
|
183
|
+
├── config.py — 50+ Pydantic config models
|
|
184
|
+
├── models.py — Finding, ScanResult (stable contract)
|
|
185
|
+
├── engine/
|
|
186
|
+
│ ├── scanner.py — Threaded orchestrator
|
|
187
|
+
│ ├── duplication.py — Cross-file copy-paste detector
|
|
188
|
+
│ ├── suppression.py — Inline ignore parser
|
|
189
|
+
│ └── context_filter.py — String/comment detector
|
|
190
|
+
├── parsers/
|
|
191
|
+
│ └── treesitter.py — Optional AST adapter
|
|
192
|
+
├── rules/
|
|
193
|
+
│ ├── generic/ — 71 cross-repo rules
|
|
194
|
+
│ └── repo/ — 1 architecture rule
|
|
195
|
+
├── output/
|
|
196
|
+
│ ├── sarif.py — SARIF v2.1.0
|
|
197
|
+
│ ├── annotations.py — GitHub annotations
|
|
198
|
+
│ └── markdown_summary.py
|
|
199
|
+
└── state/
|
|
200
|
+
└── store.py — Baseline persistence
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
Requires Python 3.12+ and [Poetry](https://python-poetry.org/) 2.x.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
poetry install # add --all-extras for tree-sitter and requests
|
|
209
|
+
poetry run pytest
|
|
210
|
+
poetry run ruff check .
|
|
211
|
+
poetry build
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
[MIT](LICENSE) — Euraika 2026. Fork maintained by Digitalist.
|
|
217
|
+
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# doc-ai-slopcheck
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[]()
|
|
5
|
+
|
|
6
|
+
**Deterministic scanner for AI-style code failures. 73 rules. No LLM. No backend.**
|
|
7
|
+
|
|
8
|
+
Digitalist fork of [ai-slopcheck](https://github.com/Euraika-Labs/ai_slopcheck) by Euraika, which is no longer published.
|
|
9
|
+
|
|
10
|
+
> Catches the mistakes AI coding assistants leave behind — stub functions, silent error handling, hallucinated placeholders, hardcoded secrets, and 68 more patterns across Python, JS/TS, Go, C/C++, SQL, and Markdown.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pip install git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Scan a project
|
|
24
|
+
doc-ai-slopcheck scan . --output findings.json --fail-on warning
|
|
25
|
+
|
|
26
|
+
# View results
|
|
27
|
+
doc-ai-slopcheck summary findings.json
|
|
28
|
+
|
|
29
|
+
# GitHub Security tab (SARIF)
|
|
30
|
+
doc-ai-slopcheck sarif findings.json
|
|
31
|
+
|
|
32
|
+
# Only scan changed files (CI)
|
|
33
|
+
doc-ai-slopcheck scan . --changed-files git --fail-on warning
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## What It Catches
|
|
37
|
+
|
|
38
|
+
| Category | Rules | Examples |
|
|
39
|
+
|----------|:-----:|---------|
|
|
40
|
+
| **AI Detection** | 16 | Stub functions, instruction comments, plan/task IDs in comments, conversational bleed, identity refusals |
|
|
41
|
+
| **Security** | 7 | Hardcoded secrets, SQL injection, XSS, weak hashing, obfuscated code |
|
|
42
|
+
| **JavaScript / Node** | 11 | await-in-loop, unguarded JSON.parse, loose equality, React antipatterns |
|
|
43
|
+
| **Go** | 3 | Ignored errors, missing defer, wrong error wrapping |
|
|
44
|
+
| **Python** | 1 | Mutable default arguments |
|
|
45
|
+
| **Cross-Language** | 17 | Debug code, unreachable code, deep inheritance, dangerous shell in markdown |
|
|
46
|
+
| **Data-Flow** | 4 | Contradictory null checks, lock safety, IDOR risk, thread-unsafe globals |
|
|
47
|
+
| **Quality** | 9 | Large functions (>150 lines), copy-pasted code across files, plus opt-in deep nesting |
|
|
48
|
+
| **API Contract** | 1 | Removed routes, deprecated endpoints |
|
|
49
|
+
| **Repo-Specific** | 1 | Import boundary violations |
|
|
50
|
+
| **Meta** | 1 | Unused suppression directives |
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
- **73 deterministic rules** — no LLM, no network, no randomness
|
|
55
|
+
- **6 languages** — Python, JS/TS, Go, C/C++, SQL, Markdown
|
|
56
|
+
- **Inline suppression** — `# slopcheck: ignore[rule_id]`, or `# slopcheck: ignore-next[duplicate_code]` above a copied block
|
|
57
|
+
- **SARIF output** — integrates with GitHub Security tab
|
|
58
|
+
- **HTML report** — standalone, shareable page (`doc-ai-slopcheck html findings.json > report.html`)
|
|
59
|
+
- **Diff-only mode** — scan only changed files (`--changed-files git`)
|
|
60
|
+
- **Baselines** — suppress existing findings, fail only on new ones
|
|
61
|
+
- **API snapshots** — detect removed API routes
|
|
62
|
+
- **Tree-sitter** — optional AST context for better precision
|
|
63
|
+
- **Threaded** — multi-core scanning (`--jobs N`)
|
|
64
|
+
- **Confidence filtering** — `--min-confidence medium` for high-signal-only mode
|
|
65
|
+
|
|
66
|
+
## GitHub Actions
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
name: slopcheck
|
|
70
|
+
on: [pull_request]
|
|
71
|
+
jobs:
|
|
72
|
+
scan:
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
- uses: actions/setup-python@v5
|
|
77
|
+
with: { python-version: '3.12' }
|
|
78
|
+
- run: pip install git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git
|
|
79
|
+
- run: doc-ai-slopcheck scan . --output findings.json --fail-on warning
|
|
80
|
+
- run: doc-ai-slopcheck github-annotations findings.json
|
|
81
|
+
- run: doc-ai-slopcheck sarif findings.json > results.sarif
|
|
82
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
83
|
+
with: { sarif_file: results.sarif }
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Baselines (Incremental Adoption)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# First run: baseline existing findings
|
|
90
|
+
doc-ai-slopcheck scan . --output findings.json --fail-on none
|
|
91
|
+
doc-ai-slopcheck create-baseline findings.json
|
|
92
|
+
|
|
93
|
+
# CI: only fail on NEW findings
|
|
94
|
+
doc-ai-slopcheck scan . --baseline .slopcheck/baseline.json --fail-on warning
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## CLI Reference
|
|
98
|
+
|
|
99
|
+
| Command | Purpose |
|
|
100
|
+
|---------|---------|
|
|
101
|
+
| `doc-ai-slopcheck scan [paths]` | Scan files, write findings JSON |
|
|
102
|
+
| `doc-ai-slopcheck summary <file>` | Markdown summary |
|
|
103
|
+
| `doc-ai-slopcheck github-annotations <file>` | GitHub workflow annotations |
|
|
104
|
+
| `doc-ai-slopcheck sarif <file>` | SARIF v2.1.0 output |
|
|
105
|
+
| `doc-ai-slopcheck html <file> > report.html` | Standalone HTML report |
|
|
106
|
+
| `doc-ai-slopcheck create-baseline <file>` | Create fingerprint baseline |
|
|
107
|
+
| `doc-ai-slopcheck api-snapshot` | Snapshot API routes for contract checks |
|
|
108
|
+
|
|
109
|
+
### Key `scan` Options
|
|
110
|
+
|
|
111
|
+
| Option | Default | Description |
|
|
112
|
+
|--------|---------|-------------|
|
|
113
|
+
| `--fail-on` | `error` | Exit 1 at severity: `none` / `note` / `warning` / `error` |
|
|
114
|
+
| `--min-confidence` | `low` | Filter: `low` / `medium` / `high` |
|
|
115
|
+
| `--baseline` | — | Suppress fingerprints from baseline file |
|
|
116
|
+
| `--changed-files` | — | `git` or `@file.txt` for diff-only mode |
|
|
117
|
+
| `--jobs` | auto | Thread count (0=auto, 1=sequential) |
|
|
118
|
+
| `--api-baseline` | — | API snapshot for contract comparison |
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
Create `.slopcheck/config.yaml` (or `.slopcheck.yaml`):
|
|
123
|
+
|
|
124
|
+
```yaml
|
|
125
|
+
rules:
|
|
126
|
+
# Disable a rule
|
|
127
|
+
js_loose_equality:
|
|
128
|
+
enabled: false
|
|
129
|
+
|
|
130
|
+
# Enable an opt-in rule with custom threshold
|
|
131
|
+
deep_nesting:
|
|
132
|
+
enabled: true
|
|
133
|
+
max_depth: 5
|
|
134
|
+
|
|
135
|
+
# Configure detection
|
|
136
|
+
hallucinated_placeholder:
|
|
137
|
+
allowed_domains: ["example.com", "localhost"]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Tree-sitter (Optional)
|
|
141
|
+
|
|
142
|
+
For better precision (~5% improvement on string/comment context detection):
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
pip install "doc-ai-slopcheck[ast] @ git+https://github.com/Digitalist-Open-Cloud/AI-Slopcheck.git"
|
|
146
|
+
# Or manually:
|
|
147
|
+
pip install tree-sitter-python tree-sitter-javascript tree-sitter-go tree-sitter-typescript
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Project Layout
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
doc_ai_slopcheck/
|
|
154
|
+
├── cli.py — 6 CLI commands
|
|
155
|
+
├── config.py — 50+ Pydantic config models
|
|
156
|
+
├── models.py — Finding, ScanResult (stable contract)
|
|
157
|
+
├── engine/
|
|
158
|
+
│ ├── scanner.py — Threaded orchestrator
|
|
159
|
+
│ ├── duplication.py — Cross-file copy-paste detector
|
|
160
|
+
│ ├── suppression.py — Inline ignore parser
|
|
161
|
+
│ └── context_filter.py — String/comment detector
|
|
162
|
+
├── parsers/
|
|
163
|
+
│ └── treesitter.py — Optional AST adapter
|
|
164
|
+
├── rules/
|
|
165
|
+
│ ├── generic/ — 71 cross-repo rules
|
|
166
|
+
│ └── repo/ — 1 architecture rule
|
|
167
|
+
├── output/
|
|
168
|
+
│ ├── sarif.py — SARIF v2.1.0
|
|
169
|
+
│ ├── annotations.py — GitHub annotations
|
|
170
|
+
│ └── markdown_summary.py
|
|
171
|
+
└── state/
|
|
172
|
+
└── store.py — Baseline persistence
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
Requires Python 3.12+ and [Poetry](https://python-poetry.org/) 2.x.
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
poetry install # add --all-extras for tree-sitter and requests
|
|
181
|
+
poetry run pytest
|
|
182
|
+
poetry run ruff check .
|
|
183
|
+
poetry build
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
[MIT](LICENSE) — Euraika 2026. Fork maintained by Digitalist.
|