git-slopcheck 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.
Files changed (29) hide show
  1. git_slopcheck-0.1.0/LICENSE +17 -0
  2. git_slopcheck-0.1.0/PKG-INFO +173 -0
  3. git_slopcheck-0.1.0/README.md +147 -0
  4. git_slopcheck-0.1.0/pyproject.toml +49 -0
  5. git_slopcheck-0.1.0/setup.cfg +4 -0
  6. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/PKG-INFO +173 -0
  7. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/SOURCES.txt +27 -0
  8. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/dependency_links.txt +1 -0
  9. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/entry_points.txt +2 -0
  10. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/requires.txt +5 -0
  11. git_slopcheck-0.1.0/src/git_slopcheck.egg-info/top_level.txt +1 -0
  12. git_slopcheck-0.1.0/src/slopcheck/__init__.py +1 -0
  13. git_slopcheck-0.1.0/src/slopcheck/cli.py +53 -0
  14. git_slopcheck-0.1.0/src/slopcheck/diff_parser.py +96 -0
  15. git_slopcheck-0.1.0/src/slopcheck/parser.py +41 -0
  16. git_slopcheck-0.1.0/src/slopcheck/rules/__init__.py +17 -0
  17. git_slopcheck-0.1.0/src/slopcheck/rules/base.py +9 -0
  18. git_slopcheck-0.1.0/src/slopcheck/rules/filler_docstrings.py +113 -0
  19. git_slopcheck-0.1.0/src/slopcheck/rules/micro_wrappers.py +179 -0
  20. git_slopcheck-0.1.0/src/slopcheck/rules/obvious_comments.py +132 -0
  21. git_slopcheck-0.1.0/src/slopcheck/rules/swallowed_exceptions.py +137 -0
  22. git_slopcheck-0.1.0/src/slopcheck/runner.py +82 -0
  23. git_slopcheck-0.1.0/tests/test_cli.py +162 -0
  24. git_slopcheck-0.1.0/tests/test_diff_parser.py +126 -0
  25. git_slopcheck-0.1.0/tests/test_filler_docstrings.py +84 -0
  26. git_slopcheck-0.1.0/tests/test_micro_wrappers.py +142 -0
  27. git_slopcheck-0.1.0/tests/test_obvious_comments.py +75 -0
  28. git_slopcheck-0.1.0/tests/test_parser.py +79 -0
  29. git_slopcheck-0.1.0/tests/test_swallowed_exceptions.py +77 -0
@@ -0,0 +1,17 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raja
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-slopcheck
3
+ Version: 0.1.0
4
+ Summary: 100% offline CLI tool scanning staged git diffs for AI code smells using Tree-sitter.
5
+ Author: Raja
6
+ License: MIT
7
+ Keywords: linter,git,tree-sitter,ast,cli,static-analysis
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: tree-sitter>=0.25.0
22
+ Requires-Dist: tree-sitter-python>=0.25.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # slopcheck
28
+
29
+ A 100% offline, zero-cost Python CLI tool that scans `git diff --cached` using Tree-sitter AST analysis to catch AI-generated code slop before you commit.
30
+
31
+ ## Features & Detection Rules
32
+
33
+ `slopcheck` analyzes only your staged changes across four distinct code smells:
34
+
35
+ ### 1. `obvious-comment` (Captain Obvious Comments)
36
+ Flags comments that repeat $>70\%$ of the words from the identifier defined on the immediately following line (skipping pragmas like `# type: ignore` and `# noqa`).
37
+
38
+ ```python
39
+ # Bad: repeats the next-line function name
40
+ # Calculate total
41
+ def calculate_total():
42
+ return 100
43
+
44
+ # Good: explains why or provides architectural context
45
+ # Cache result for 5 minutes to reduce database read load
46
+ def calculate_total():
47
+ return 100
48
+ ```
49
+
50
+ ### 2. `swallowed-exception` (Swallowed Exceptions)
51
+ Flags broad catches (`except:`, `except Exception`, `except BaseException`, `except* Exception`) whose body only consists of `pass`, `...`, `print(...)`, or contextless `raise`.
52
+
53
+ ```python
54
+ # Bad: silently swallows errors or only prints
55
+ try:
56
+ process_order()
57
+ except Exception as e:
58
+ print(e)
59
+
60
+ # Good: proper logging, context re-raising, or specific catch
61
+ try:
62
+ process_order()
63
+ except ValueError:
64
+ handle_invalid_order()
65
+ except Exception as e:
66
+ logger.exception("Order processing failed")
67
+ raise OrderProcessingError("Order failure") from e
68
+ ```
69
+
70
+ ### 3. `micro-wrapper` (Single-Use Micro-Wrappers)
71
+ Flags newly added functions of 1–2 statements that are only invoked once across the entire repository (skipping `@property`, `@abstractmethod`, dunders like `__init__`, and `test_*` functions).
72
+
73
+ ```python
74
+ # Bad: single-use helper that adds indirection without reuse
75
+ def _fetch_user_raw(user_id: int):
76
+ return db.query(User).get(user_id)
77
+
78
+ def get_user_profile(user_id: int):
79
+ user = _fetch_user_raw(user_id) # Only call in the whole repo
80
+ return user.to_dict()
81
+ ```
82
+
83
+ ### 4. `filler-docstring` (AI Filler Docstrings)
84
+ Flags boilerplate docstrings filled with common LLM introductory phrases like *"This function is responsible for..."* or *"Helper method to..."*.
85
+
86
+ ```python
87
+ # Bad: LLM boilerplate filler
88
+ def parse_config(path: str):
89
+ """This function is responsible for parsing configuration files."""
90
+ ...
91
+
92
+ # Good: concise and domain-specific
93
+ def parse_config(path: str):
94
+ """Parse YAML settings into application configuration options."""
95
+ ...
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Installation
101
+
102
+ Install from PyPI:
103
+ ```bash
104
+ pip install git-slopcheck
105
+ ```
106
+
107
+ Or install locally for development:
108
+ ```bash
109
+ git clone https://github.com/complex-day/Slopcheck.git
110
+ cd Slopcheck
111
+ pip install -e ".[dev]"
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Usage
117
+
118
+ Run `slopcheck` against currently staged changes in your git repository:
119
+
120
+ ```bash
121
+ # Scan staged changes in current working tree
122
+ slopcheck
123
+
124
+ # Scan staged changes in a specific repository root
125
+ slopcheck --repo /path/to/repo
126
+
127
+ # Check version
128
+ slopcheck --version
129
+ ```
130
+
131
+ ### Sample Output
132
+
133
+ ```
134
+ app.py:1: [filler-docstring] AI filler docstring detected: contains boilerplate phrase 'this module is responsible for'
135
+ app.py:3: [obvious-comment] Obvious comment duplicates identifier 'calculate_total'
136
+ app.py:8: [micro-wrapper] Single-use micro-wrapper '_tiny_helper' has 1 statement(s) and is only called once
137
+ app.py:16: [swallowed-exception] Swallowed exception caught without proper logging or handling
138
+
139
+ slopcheck: Found 4 violation(s) across 1 staged file(s).
140
+ ```
141
+
142
+ When no violations are found:
143
+ ```
144
+ slopcheck: Clean! Scanned 2 staged file(s) with 0 violations.
145
+ ```
146
+
147
+ ### Exit Codes
148
+
149
+ | Exit Code | Meaning |
150
+ | :---: | :--- |
151
+ | `0` | Clean: No violations detected, or no staged Python files to check. |
152
+ | `1` | Violations: One or more code smell violations detected in staged diff. |
153
+ | `2` | Error: Git execution failed or directory is not a Git repository. |
154
+
155
+ ---
156
+
157
+ ## Pre-commit Integration
158
+
159
+ Add `slopcheck` as a pre-commit hook in your `.pre-commit-config.yaml`:
160
+
161
+ ```yaml
162
+ repos:
163
+ - repo: https://github.com/complex-day/Slopcheck
164
+ rev: v0.1.0
165
+ hooks:
166
+ - id: slopcheck
167
+ ```
168
+
169
+ ---
170
+
171
+ ## License
172
+
173
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,147 @@
1
+ # slopcheck
2
+
3
+ A 100% offline, zero-cost Python CLI tool that scans `git diff --cached` using Tree-sitter AST analysis to catch AI-generated code slop before you commit.
4
+
5
+ ## Features & Detection Rules
6
+
7
+ `slopcheck` analyzes only your staged changes across four distinct code smells:
8
+
9
+ ### 1. `obvious-comment` (Captain Obvious Comments)
10
+ Flags comments that repeat $>70\%$ of the words from the identifier defined on the immediately following line (skipping pragmas like `# type: ignore` and `# noqa`).
11
+
12
+ ```python
13
+ # Bad: repeats the next-line function name
14
+ # Calculate total
15
+ def calculate_total():
16
+ return 100
17
+
18
+ # Good: explains why or provides architectural context
19
+ # Cache result for 5 minutes to reduce database read load
20
+ def calculate_total():
21
+ return 100
22
+ ```
23
+
24
+ ### 2. `swallowed-exception` (Swallowed Exceptions)
25
+ Flags broad catches (`except:`, `except Exception`, `except BaseException`, `except* Exception`) whose body only consists of `pass`, `...`, `print(...)`, or contextless `raise`.
26
+
27
+ ```python
28
+ # Bad: silently swallows errors or only prints
29
+ try:
30
+ process_order()
31
+ except Exception as e:
32
+ print(e)
33
+
34
+ # Good: proper logging, context re-raising, or specific catch
35
+ try:
36
+ process_order()
37
+ except ValueError:
38
+ handle_invalid_order()
39
+ except Exception as e:
40
+ logger.exception("Order processing failed")
41
+ raise OrderProcessingError("Order failure") from e
42
+ ```
43
+
44
+ ### 3. `micro-wrapper` (Single-Use Micro-Wrappers)
45
+ Flags newly added functions of 1–2 statements that are only invoked once across the entire repository (skipping `@property`, `@abstractmethod`, dunders like `__init__`, and `test_*` functions).
46
+
47
+ ```python
48
+ # Bad: single-use helper that adds indirection without reuse
49
+ def _fetch_user_raw(user_id: int):
50
+ return db.query(User).get(user_id)
51
+
52
+ def get_user_profile(user_id: int):
53
+ user = _fetch_user_raw(user_id) # Only call in the whole repo
54
+ return user.to_dict()
55
+ ```
56
+
57
+ ### 4. `filler-docstring` (AI Filler Docstrings)
58
+ Flags boilerplate docstrings filled with common LLM introductory phrases like *"This function is responsible for..."* or *"Helper method to..."*.
59
+
60
+ ```python
61
+ # Bad: LLM boilerplate filler
62
+ def parse_config(path: str):
63
+ """This function is responsible for parsing configuration files."""
64
+ ...
65
+
66
+ # Good: concise and domain-specific
67
+ def parse_config(path: str):
68
+ """Parse YAML settings into application configuration options."""
69
+ ...
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Installation
75
+
76
+ Install from PyPI:
77
+ ```bash
78
+ pip install git-slopcheck
79
+ ```
80
+
81
+ Or install locally for development:
82
+ ```bash
83
+ git clone https://github.com/complex-day/Slopcheck.git
84
+ cd Slopcheck
85
+ pip install -e ".[dev]"
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Usage
91
+
92
+ Run `slopcheck` against currently staged changes in your git repository:
93
+
94
+ ```bash
95
+ # Scan staged changes in current working tree
96
+ slopcheck
97
+
98
+ # Scan staged changes in a specific repository root
99
+ slopcheck --repo /path/to/repo
100
+
101
+ # Check version
102
+ slopcheck --version
103
+ ```
104
+
105
+ ### Sample Output
106
+
107
+ ```
108
+ app.py:1: [filler-docstring] AI filler docstring detected: contains boilerplate phrase 'this module is responsible for'
109
+ app.py:3: [obvious-comment] Obvious comment duplicates identifier 'calculate_total'
110
+ app.py:8: [micro-wrapper] Single-use micro-wrapper '_tiny_helper' has 1 statement(s) and is only called once
111
+ app.py:16: [swallowed-exception] Swallowed exception caught without proper logging or handling
112
+
113
+ slopcheck: Found 4 violation(s) across 1 staged file(s).
114
+ ```
115
+
116
+ When no violations are found:
117
+ ```
118
+ slopcheck: Clean! Scanned 2 staged file(s) with 0 violations.
119
+ ```
120
+
121
+ ### Exit Codes
122
+
123
+ | Exit Code | Meaning |
124
+ | :---: | :--- |
125
+ | `0` | Clean: No violations detected, or no staged Python files to check. |
126
+ | `1` | Violations: One or more code smell violations detected in staged diff. |
127
+ | `2` | Error: Git execution failed or directory is not a Git repository. |
128
+
129
+ ---
130
+
131
+ ## Pre-commit Integration
132
+
133
+ Add `slopcheck` as a pre-commit hook in your `.pre-commit-config.yaml`:
134
+
135
+ ```yaml
136
+ repos:
137
+ - repo: https://github.com/complex-day/Slopcheck
138
+ rev: v0.1.0
139
+ hooks:
140
+ - id: slopcheck
141
+ ```
142
+
143
+ ---
144
+
145
+ ## License
146
+
147
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "git-slopcheck"
7
+ version = "0.1.0"
8
+ description = "100% offline CLI tool scanning staged git diffs for AI code smells using Tree-sitter."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Raja"},
14
+ ]
15
+ keywords = [
16
+ "linter",
17
+ "git",
18
+ "tree-sitter",
19
+ "ast",
20
+ "cli",
21
+ "static-analysis",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 4 - Beta",
25
+ "Environment :: Console",
26
+ "Intended Audience :: Developers",
27
+ "License :: OSI Approved :: MIT License",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Programming Language :: Python :: 3.14",
33
+ "Topic :: Software Development :: Quality Assurance",
34
+ ]
35
+ dependencies = [
36
+ "tree-sitter>=0.25.0",
37
+ "tree-sitter-python>=0.25.0",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ dev = [
42
+ "pytest",
43
+ ]
44
+
45
+ [project.scripts]
46
+ slopcheck = "slopcheck.cli:main"
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,173 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-slopcheck
3
+ Version: 0.1.0
4
+ Summary: 100% offline CLI tool scanning staged git diffs for AI code smells using Tree-sitter.
5
+ Author: Raja
6
+ License: MIT
7
+ Keywords: linter,git,tree-sitter,ast,cli,static-analysis
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Topic :: Software Development :: Quality Assurance
18
+ Requires-Python: >=3.11
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: tree-sitter>=0.25.0
22
+ Requires-Dist: tree-sitter-python>=0.25.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # slopcheck
28
+
29
+ A 100% offline, zero-cost Python CLI tool that scans `git diff --cached` using Tree-sitter AST analysis to catch AI-generated code slop before you commit.
30
+
31
+ ## Features & Detection Rules
32
+
33
+ `slopcheck` analyzes only your staged changes across four distinct code smells:
34
+
35
+ ### 1. `obvious-comment` (Captain Obvious Comments)
36
+ Flags comments that repeat $>70\%$ of the words from the identifier defined on the immediately following line (skipping pragmas like `# type: ignore` and `# noqa`).
37
+
38
+ ```python
39
+ # Bad: repeats the next-line function name
40
+ # Calculate total
41
+ def calculate_total():
42
+ return 100
43
+
44
+ # Good: explains why or provides architectural context
45
+ # Cache result for 5 minutes to reduce database read load
46
+ def calculate_total():
47
+ return 100
48
+ ```
49
+
50
+ ### 2. `swallowed-exception` (Swallowed Exceptions)
51
+ Flags broad catches (`except:`, `except Exception`, `except BaseException`, `except* Exception`) whose body only consists of `pass`, `...`, `print(...)`, or contextless `raise`.
52
+
53
+ ```python
54
+ # Bad: silently swallows errors or only prints
55
+ try:
56
+ process_order()
57
+ except Exception as e:
58
+ print(e)
59
+
60
+ # Good: proper logging, context re-raising, or specific catch
61
+ try:
62
+ process_order()
63
+ except ValueError:
64
+ handle_invalid_order()
65
+ except Exception as e:
66
+ logger.exception("Order processing failed")
67
+ raise OrderProcessingError("Order failure") from e
68
+ ```
69
+
70
+ ### 3. `micro-wrapper` (Single-Use Micro-Wrappers)
71
+ Flags newly added functions of 1–2 statements that are only invoked once across the entire repository (skipping `@property`, `@abstractmethod`, dunders like `__init__`, and `test_*` functions).
72
+
73
+ ```python
74
+ # Bad: single-use helper that adds indirection without reuse
75
+ def _fetch_user_raw(user_id: int):
76
+ return db.query(User).get(user_id)
77
+
78
+ def get_user_profile(user_id: int):
79
+ user = _fetch_user_raw(user_id) # Only call in the whole repo
80
+ return user.to_dict()
81
+ ```
82
+
83
+ ### 4. `filler-docstring` (AI Filler Docstrings)
84
+ Flags boilerplate docstrings filled with common LLM introductory phrases like *"This function is responsible for..."* or *"Helper method to..."*.
85
+
86
+ ```python
87
+ # Bad: LLM boilerplate filler
88
+ def parse_config(path: str):
89
+ """This function is responsible for parsing configuration files."""
90
+ ...
91
+
92
+ # Good: concise and domain-specific
93
+ def parse_config(path: str):
94
+ """Parse YAML settings into application configuration options."""
95
+ ...
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Installation
101
+
102
+ Install from PyPI:
103
+ ```bash
104
+ pip install git-slopcheck
105
+ ```
106
+
107
+ Or install locally for development:
108
+ ```bash
109
+ git clone https://github.com/complex-day/Slopcheck.git
110
+ cd Slopcheck
111
+ pip install -e ".[dev]"
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Usage
117
+
118
+ Run `slopcheck` against currently staged changes in your git repository:
119
+
120
+ ```bash
121
+ # Scan staged changes in current working tree
122
+ slopcheck
123
+
124
+ # Scan staged changes in a specific repository root
125
+ slopcheck --repo /path/to/repo
126
+
127
+ # Check version
128
+ slopcheck --version
129
+ ```
130
+
131
+ ### Sample Output
132
+
133
+ ```
134
+ app.py:1: [filler-docstring] AI filler docstring detected: contains boilerplate phrase 'this module is responsible for'
135
+ app.py:3: [obvious-comment] Obvious comment duplicates identifier 'calculate_total'
136
+ app.py:8: [micro-wrapper] Single-use micro-wrapper '_tiny_helper' has 1 statement(s) and is only called once
137
+ app.py:16: [swallowed-exception] Swallowed exception caught without proper logging or handling
138
+
139
+ slopcheck: Found 4 violation(s) across 1 staged file(s).
140
+ ```
141
+
142
+ When no violations are found:
143
+ ```
144
+ slopcheck: Clean! Scanned 2 staged file(s) with 0 violations.
145
+ ```
146
+
147
+ ### Exit Codes
148
+
149
+ | Exit Code | Meaning |
150
+ | :---: | :--- |
151
+ | `0` | Clean: No violations detected, or no staged Python files to check. |
152
+ | `1` | Violations: One or more code smell violations detected in staged diff. |
153
+ | `2` | Error: Git execution failed or directory is not a Git repository. |
154
+
155
+ ---
156
+
157
+ ## Pre-commit Integration
158
+
159
+ Add `slopcheck` as a pre-commit hook in your `.pre-commit-config.yaml`:
160
+
161
+ ```yaml
162
+ repos:
163
+ - repo: https://github.com/complex-day/Slopcheck
164
+ rev: v0.1.0
165
+ hooks:
166
+ - id: slopcheck
167
+ ```
168
+
169
+ ---
170
+
171
+ ## License
172
+
173
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,27 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/git_slopcheck.egg-info/PKG-INFO
5
+ src/git_slopcheck.egg-info/SOURCES.txt
6
+ src/git_slopcheck.egg-info/dependency_links.txt
7
+ src/git_slopcheck.egg-info/entry_points.txt
8
+ src/git_slopcheck.egg-info/requires.txt
9
+ src/git_slopcheck.egg-info/top_level.txt
10
+ src/slopcheck/__init__.py
11
+ src/slopcheck/cli.py
12
+ src/slopcheck/diff_parser.py
13
+ src/slopcheck/parser.py
14
+ src/slopcheck/runner.py
15
+ src/slopcheck/rules/__init__.py
16
+ src/slopcheck/rules/base.py
17
+ src/slopcheck/rules/filler_docstrings.py
18
+ src/slopcheck/rules/micro_wrappers.py
19
+ src/slopcheck/rules/obvious_comments.py
20
+ src/slopcheck/rules/swallowed_exceptions.py
21
+ tests/test_cli.py
22
+ tests/test_diff_parser.py
23
+ tests/test_filler_docstrings.py
24
+ tests/test_micro_wrappers.py
25
+ tests/test_obvious_comments.py
26
+ tests/test_parser.py
27
+ tests/test_swallowed_exceptions.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ slopcheck = slopcheck.cli:main
@@ -0,0 +1,5 @@
1
+ tree-sitter>=0.25.0
2
+ tree-sitter-python>=0.25.0
3
+
4
+ [dev]
5
+ pytest
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,53 @@
1
+ import argparse
2
+ import sys
3
+ from slopcheck import __version__
4
+ from slopcheck.diff_parser import GitDiffError
5
+ from slopcheck.runner import scan_staged
6
+
7
+
8
+ def main(argv: list[str] | None = None) -> int:
9
+ parser = argparse.ArgumentParser(
10
+ prog="slopcheck",
11
+ description="A 100% offline CLI tool to detect AI-generated code slop in staged git changes.",
12
+ )
13
+ parser.add_argument(
14
+ "--version",
15
+ action="version",
16
+ version=f"%(prog)s {__version__}",
17
+ )
18
+ parser.add_argument(
19
+ "--repo",
20
+ type=str,
21
+ default=None,
22
+ help="Path to the Git repository root (defaults to current working directory).",
23
+ )
24
+
25
+ args = parser.parse_args(argv)
26
+
27
+ try:
28
+ violations, files_scanned = scan_staged(repo_root=args.repo)
29
+ except GitDiffError as err:
30
+ print(f"slopcheck error: {err}", file=sys.stderr)
31
+ return 2
32
+
33
+ if files_scanned == 0:
34
+ print("slopcheck: No staged Python files to check.")
35
+ return 0
36
+
37
+ if not violations:
38
+ print(
39
+ f"slopcheck: Clean! Scanned {files_scanned} staged file(s) with 0 violations."
40
+ )
41
+ return 0
42
+
43
+ for v in violations:
44
+ print(f"{v.file_path}:{v.line}: [{v.rule_id}] {v.message}")
45
+
46
+ print(
47
+ f"\nslopcheck: Found {len(violations)} violation(s) across {files_scanned} staged file(s)."
48
+ )
49
+ return 1
50
+
51
+
52
+ if __name__ == "__main__":
53
+ sys.exit(main())