slopfence 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.
- slopfence-0.1.0/.editorconfig +15 -0
- slopfence-0.1.0/.github/CODEOWNERS +6 -0
- slopfence-0.1.0/.github/ISSUE_TEMPLATE/1-bug_report.yml +42 -0
- slopfence-0.1.0/.github/ISSUE_TEMPLATE/2-false_positive.yml +35 -0
- slopfence-0.1.0/.github/ISSUE_TEMPLATE/3-detector_proposal.yml +39 -0
- slopfence-0.1.0/.github/ISSUE_TEMPLATE/4-ai_junk_example.yml +36 -0
- slopfence-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
- slopfence-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +27 -0
- slopfence-0.1.0/.github/dependabot.yml +21 -0
- slopfence-0.1.0/.github/workflows/ci.yml +69 -0
- slopfence-0.1.0/.github/workflows/release.yml +81 -0
- slopfence-0.1.0/.gitignore +11 -0
- slopfence-0.1.0/.markdownlint-cli2.yaml +9 -0
- slopfence-0.1.0/.pre-commit-hooks.yaml +8 -0
- slopfence-0.1.0/CHANGELOG.md +32 -0
- slopfence-0.1.0/CODE_OF_CONDUCT.md +128 -0
- slopfence-0.1.0/CONTRIBUTING.md +96 -0
- slopfence-0.1.0/GOVERNANCE.md +23 -0
- slopfence-0.1.0/LICENSE +21 -0
- slopfence-0.1.0/PKG-INFO +295 -0
- slopfence-0.1.0/README.md +263 -0
- slopfence-0.1.0/SECURITY.md +50 -0
- slopfence-0.1.0/SUPPORT.md +12 -0
- slopfence-0.1.0/action.yml +70 -0
- slopfence-0.1.0/pyproject.toml +60 -0
- slopfence-0.1.0/src/slopfence/__init__.py +3 -0
- slopfence-0.1.0/src/slopfence/__main__.py +5 -0
- slopfence-0.1.0/src/slopfence/cli.py +106 -0
- slopfence-0.1.0/src/slopfence/detectors/__init__.py +17 -0
- slopfence-0.1.0/src/slopfence/detectors/packages.py +465 -0
- slopfence-0.1.0/src/slopfence/detectors/test_quality.py +363 -0
- slopfence-0.1.0/src/slopfence/detectors/text_patterns.py +74 -0
- slopfence-0.1.0/src/slopfence/diff.py +104 -0
- slopfence-0.1.0/src/slopfence/engine.py +134 -0
- slopfence-0.1.0/src/slopfence/models.py +76 -0
- slopfence-0.1.0/src/slopfence/registry.py +97 -0
- slopfence-0.1.0/src/slopfence/reporters.py +115 -0
- slopfence-0.1.0/src/slopfence/source.py +141 -0
- slopfence-0.1.0/tests/__init__.py +0 -0
- slopfence-0.1.0/tests/conftest.py +55 -0
- slopfence-0.1.0/tests/test_cli.py +158 -0
- slopfence-0.1.0/tests/test_packages.py +263 -0
- slopfence-0.1.0/tests/test_test_quality.py +284 -0
- slopfence-0.1.0/tests/test_text_patterns.py +141 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
indent_style = space
|
|
9
|
+
indent_size = 4
|
|
10
|
+
|
|
11
|
+
[*.{yml,yaml,json,toml,md}]
|
|
12
|
+
indent_size = 2
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: 🐛 Bug report
|
|
2
|
+
description: slopfence crashed or behaved incorrectly
|
|
3
|
+
labels: ["bug", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for reporting! If slopfence flagged code it shouldn't have, use the **False positive** template instead.
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: what-happened
|
|
11
|
+
attributes:
|
|
12
|
+
label: What happened?
|
|
13
|
+
description: What did you expect, and what happened instead?
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: reproduce
|
|
18
|
+
attributes:
|
|
19
|
+
label: Steps to reproduce
|
|
20
|
+
description: Minimal code and the exact command you ran.
|
|
21
|
+
render: shell
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: output
|
|
26
|
+
attributes:
|
|
27
|
+
label: Output / traceback
|
|
28
|
+
render: shell
|
|
29
|
+
- type: input
|
|
30
|
+
id: version
|
|
31
|
+
attributes:
|
|
32
|
+
label: slopfence version
|
|
33
|
+
placeholder: "slopfence --version"
|
|
34
|
+
validations:
|
|
35
|
+
required: true
|
|
36
|
+
- type: input
|
|
37
|
+
id: environment
|
|
38
|
+
attributes:
|
|
39
|
+
label: OS and Python version
|
|
40
|
+
placeholder: "Ubuntu 24.04, Python 3.12"
|
|
41
|
+
validations:
|
|
42
|
+
required: true
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: 🎯 False positive
|
|
2
|
+
description: slopfence flagged code that is actually fine
|
|
3
|
+
labels: ["false-positive", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
False positives are the #1 thing we want to fix, so thank you!
|
|
9
|
+
- type: input
|
|
10
|
+
id: rule
|
|
11
|
+
attributes:
|
|
12
|
+
label: Rule ID
|
|
13
|
+
placeholder: "SLOP020"
|
|
14
|
+
validations:
|
|
15
|
+
required: true
|
|
16
|
+
- type: textarea
|
|
17
|
+
id: code
|
|
18
|
+
attributes:
|
|
19
|
+
label: Code that was flagged
|
|
20
|
+
description: The smallest snippet that reproduces it. Remove anything private.
|
|
21
|
+
render: python
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: why-ok
|
|
26
|
+
attributes:
|
|
27
|
+
label: Why is this code correct?
|
|
28
|
+
validations:
|
|
29
|
+
required: true
|
|
30
|
+
- type: input
|
|
31
|
+
id: version
|
|
32
|
+
attributes:
|
|
33
|
+
label: slopfence version
|
|
34
|
+
validations:
|
|
35
|
+
required: true
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: 💡 Detector proposal
|
|
2
|
+
description: Propose a new pattern for slopfence to detect
|
|
3
|
+
labels: ["detector", "enhancement", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: pattern
|
|
7
|
+
attributes:
|
|
8
|
+
label: What pattern should be detected?
|
|
9
|
+
description: Describe the junk pattern in one or two sentences.
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: should-flag
|
|
14
|
+
attributes:
|
|
15
|
+
label: Code that SHOULD be flagged
|
|
16
|
+
render: python
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: should-not-flag
|
|
21
|
+
attributes:
|
|
22
|
+
label: Similar code that should NOT be flagged
|
|
23
|
+
description: Helps us avoid false positives.
|
|
24
|
+
render: python
|
|
25
|
+
- type: dropdown
|
|
26
|
+
id: severity
|
|
27
|
+
attributes:
|
|
28
|
+
label: Suggested severity
|
|
29
|
+
options:
|
|
30
|
+
- High (security risk or broken behaviour)
|
|
31
|
+
- Medium (misleading or incomplete code)
|
|
32
|
+
- Low (noise or style)
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
35
|
+
- type: textarea
|
|
36
|
+
id: why
|
|
37
|
+
attributes:
|
|
38
|
+
label: Why does this matter?
|
|
39
|
+
description: Real-world impact, links, or how often you see it.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: 🤖 AI junk example
|
|
2
|
+
description: Share a real example of junk an AI coding tool produced
|
|
3
|
+
labels: ["example", "needs-triage"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Real examples are the most valuable input for designing detectors. Please remove anything private or proprietary.
|
|
9
|
+
- type: input
|
|
10
|
+
id: tool
|
|
11
|
+
attributes:
|
|
12
|
+
label: Which AI tool produced it? (optional)
|
|
13
|
+
placeholder: "Copilot, Claude, Cursor, …"
|
|
14
|
+
- type: dropdown
|
|
15
|
+
id: language
|
|
16
|
+
attributes:
|
|
17
|
+
label: Language
|
|
18
|
+
options:
|
|
19
|
+
- Python
|
|
20
|
+
- JavaScript / TypeScript
|
|
21
|
+
- Other
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: code
|
|
26
|
+
attributes:
|
|
27
|
+
label: The code
|
|
28
|
+
render: python
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: problem
|
|
33
|
+
attributes:
|
|
34
|
+
label: What's wrong with it?
|
|
35
|
+
validations:
|
|
36
|
+
required: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: 💬 Questions & ideas
|
|
4
|
+
url: https://github.com/syedmuhdahmad/slopfence/discussions
|
|
5
|
+
about: Ask questions and discuss ideas in GitHub Discussions.
|
|
6
|
+
- name: 🔒 Report a security vulnerability
|
|
7
|
+
url: https://github.com/syedmuhdahmad/slopfence/security/advisories/new
|
|
8
|
+
about: Please report security issues privately, never in a public issue.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## What does this PR do?
|
|
2
|
+
|
|
3
|
+
<!-- A short summary of the change and why it's needed. -->
|
|
4
|
+
|
|
5
|
+
Closes #
|
|
6
|
+
|
|
7
|
+
## Type of change
|
|
8
|
+
|
|
9
|
+
- [ ] Bug fix
|
|
10
|
+
- [ ] False-positive fix
|
|
11
|
+
- [ ] New detector
|
|
12
|
+
- [ ] New feature
|
|
13
|
+
- [ ] Documentation
|
|
14
|
+
- [ ] Refactor / chore
|
|
15
|
+
- [ ] Breaking change
|
|
16
|
+
|
|
17
|
+
## How was it tested?
|
|
18
|
+
|
|
19
|
+
<!-- Commands you ran, test cases you added. For detectors: include cases that SHOULD and SHOULD NOT be flagged. -->
|
|
20
|
+
|
|
21
|
+
## Checklist
|
|
22
|
+
|
|
23
|
+
- [ ] I read [CONTRIBUTING.md](../CONTRIBUTING.md)
|
|
24
|
+
- [ ] The PR title is clear (it becomes the squash-commit message)
|
|
25
|
+
- [ ] Tests added or updated for behaviour changes
|
|
26
|
+
- [ ] Docs / README updated if behaviour changed
|
|
27
|
+
- [ ] `CHANGELOG.md` updated under **Unreleased** (if user-facing)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: github-actions
|
|
4
|
+
directory: /
|
|
5
|
+
schedule:
|
|
6
|
+
interval: weekly
|
|
7
|
+
labels:
|
|
8
|
+
- dependencies
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: chore
|
|
11
|
+
groups:
|
|
12
|
+
actions:
|
|
13
|
+
patterns: ["*"]
|
|
14
|
+
- package-ecosystem: pip
|
|
15
|
+
directory: /
|
|
16
|
+
schedule:
|
|
17
|
+
interval: weekly
|
|
18
|
+
labels:
|
|
19
|
+
- dependencies
|
|
20
|
+
commit-message:
|
|
21
|
+
prefix: chore
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
merge_group:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 10
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v7
|
|
22
|
+
- uses: actions/setup-python@v7
|
|
23
|
+
with:
|
|
24
|
+
python-version: "3.13"
|
|
25
|
+
- run: pip install -e '.[dev]'
|
|
26
|
+
- name: Ruff
|
|
27
|
+
run: |
|
|
28
|
+
ruff check .
|
|
29
|
+
ruff format --check .
|
|
30
|
+
- name: slopfence checks itself
|
|
31
|
+
run: slopfence src tests
|
|
32
|
+
- name: Lint Markdown
|
|
33
|
+
uses: DavidAnson/markdownlint-cli2-action@v24
|
|
34
|
+
with:
|
|
35
|
+
globs: "**/*.md"
|
|
36
|
+
|
|
37
|
+
test:
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
timeout-minutes: 10
|
|
40
|
+
strategy:
|
|
41
|
+
fail-fast: false
|
|
42
|
+
matrix:
|
|
43
|
+
os: [ubuntu-latest]
|
|
44
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
45
|
+
include:
|
|
46
|
+
- os: macos-latest
|
|
47
|
+
python-version: "3.13"
|
|
48
|
+
- os: windows-latest
|
|
49
|
+
python-version: "3.13"
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v7
|
|
52
|
+
- uses: actions/setup-python@v7
|
|
53
|
+
with:
|
|
54
|
+
python-version: ${{ matrix.python-version }}
|
|
55
|
+
- run: pip install -e '.[dev]'
|
|
56
|
+
- run: pytest -q
|
|
57
|
+
|
|
58
|
+
# Single required status check that gates merging into main.
|
|
59
|
+
ci:
|
|
60
|
+
if: always()
|
|
61
|
+
needs: [lint, test]
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- name: All checks passed
|
|
65
|
+
if: ${{ !(contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
|
|
66
|
+
run: echo "All checks passed"
|
|
67
|
+
- name: Some checks failed
|
|
68
|
+
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
|
|
69
|
+
run: exit 1
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a GitHub release is published (tag vX.Y.Z).
|
|
4
|
+
# Uses PyPI Trusted Publishing: no API tokens are stored anywhere.
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
timeout-minutes: 10
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v7
|
|
19
|
+
with:
|
|
20
|
+
persist-credentials: false
|
|
21
|
+
- uses: actions/setup-python@v7
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.13"
|
|
24
|
+
- name: Check the tag matches the package version
|
|
25
|
+
env:
|
|
26
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
27
|
+
run: |
|
|
28
|
+
version=$(python -c "import re,pathlib; print(re.search(r'__version__ = \"(.+)\"', pathlib.Path('src/slopfence/__init__.py').read_text()).group(1))")
|
|
29
|
+
if [ "$TAG" != "v$version" ]; then
|
|
30
|
+
echo "::error::Release tag $TAG does not match package version v$version"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
- name: Build
|
|
34
|
+
run: |
|
|
35
|
+
python -m pip install --upgrade build twine
|
|
36
|
+
python -m build
|
|
37
|
+
python -m twine check --strict dist/*
|
|
38
|
+
- name: Smoke-test the wheel
|
|
39
|
+
run: |
|
|
40
|
+
python -m venv /tmp/smoke
|
|
41
|
+
/tmp/smoke/bin/pip install dist/*.whl
|
|
42
|
+
/tmp/smoke/bin/slopfence --version
|
|
43
|
+
/tmp/smoke/bin/slopfence src --offline
|
|
44
|
+
- uses: actions/upload-artifact@v7
|
|
45
|
+
with:
|
|
46
|
+
name: dist
|
|
47
|
+
path: dist/
|
|
48
|
+
if-no-files-found: error
|
|
49
|
+
|
|
50
|
+
publish-pypi:
|
|
51
|
+
needs: build
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
timeout-minutes: 10
|
|
54
|
+
environment:
|
|
55
|
+
name: pypi
|
|
56
|
+
url: https://pypi.org/project/slopfence/${{ github.event.release.tag_name }}
|
|
57
|
+
permissions:
|
|
58
|
+
id-token: write # Trusted Publishing; also signs PEP 740 attestations
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/download-artifact@v8
|
|
61
|
+
with:
|
|
62
|
+
name: dist
|
|
63
|
+
path: dist/
|
|
64
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
65
|
+
|
|
66
|
+
attach-to-release:
|
|
67
|
+
needs: build
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
timeout-minutes: 10
|
|
70
|
+
permissions:
|
|
71
|
+
contents: write
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/download-artifact@v8
|
|
74
|
+
with:
|
|
75
|
+
name: dist
|
|
76
|
+
path: dist/
|
|
77
|
+
- name: Upload wheel and sdist to the GitHub release
|
|
78
|
+
env:
|
|
79
|
+
GH_TOKEN: ${{ github.token }}
|
|
80
|
+
TAG: ${{ github.event.release.tag_name }}
|
|
81
|
+
run: gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --clobber
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
config:
|
|
2
|
+
default: true
|
|
3
|
+
MD013: false # line length: prose is wrapped by editors
|
|
4
|
+
MD033: false # inline HTML
|
|
5
|
+
MD041: false # first line heading (templates)
|
|
6
|
+
MD060: false # table column style
|
|
7
|
+
ignores:
|
|
8
|
+
- "CODE_OF_CONDUCT.md" # upstream Contributor Covenant text, kept verbatim
|
|
9
|
+
- "node_modules/**"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-10-02
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Published to PyPI as `slopfence` (the project was originally named slopcheck, but that PyPI name belongs to an unrelated project)
|
|
15
|
+
- `slopfence` CLI with `--diff`, `--format text|json|sarif`, `--select`, `--ignore`, `--offline` and `--exit-zero`
|
|
16
|
+
- `SLOP001`: dependencies and imports that don't exist on PyPI, with a local cache
|
|
17
|
+
- `SLOP010`: placeholder comments left in finished-looking code
|
|
18
|
+
- `SLOP020`: tests that only assert on their own mocks
|
|
19
|
+
- `SLOP021`: tests whose only assertions are always true
|
|
20
|
+
- `SLOP022`: tests whose assertions are swallowed by try/except
|
|
21
|
+
- `SLOP051`: leftover AI chat text in comments and docstrings
|
|
22
|
+
- `# slopfence: ignore[...]` and `# slopfence: ignore-file` directives
|
|
23
|
+
- GitHub Action (`action.yml`) and pre-commit hook
|
|
24
|
+
|
|
25
|
+
### Project setup
|
|
26
|
+
|
|
27
|
+
- Project README describing the problem, design principles, planned detectors and roadmap
|
|
28
|
+
- Community health files: Code of Conduct, Contributing guide, Security policy, Support, Governance
|
|
29
|
+
- Issue templates, pull request template, CODEOWNERS, Dependabot and CI
|
|
30
|
+
|
|
31
|
+
[Unreleased]: https://github.com/syedmuhdahmad/slopfence/compare/v0.1.0...HEAD
|
|
32
|
+
[0.1.0]: https://github.com/syedmuhdahmad/slopfence/releases/tag/v0.1.0
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
syed.muhd.ahmad@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Contributing to slopfence
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in slopfence! This project is at an early stage, which is the best time to shape it. Every kind of contribution helps: code, detector ideas, real-world examples, docs, and bug reports.
|
|
4
|
+
|
|
5
|
+
By participating, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
6
|
+
|
|
7
|
+
## Ways to contribute
|
|
8
|
+
|
|
9
|
+
| You want to… | Do this |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Share an example of AI-generated junk | Open an issue with the **AI junk example** template |
|
|
12
|
+
| Report a false positive | Open an issue with the **False positive** template |
|
|
13
|
+
| Propose a new detector | Open an issue with the **Detector proposal** template |
|
|
14
|
+
| Report a bug | Open an issue with the **Bug report** template |
|
|
15
|
+
| Ask a question or discuss an idea | Start a [Discussion](https://github.com/syedmuhdahmad/slopfence/discussions) |
|
|
16
|
+
| Report a security vulnerability | **Don't open an issue.** See [SECURITY.md](SECURITY.md) |
|
|
17
|
+
| Fix something or add a feature | Read on |
|
|
18
|
+
|
|
19
|
+
New here? Look for issues labelled [`good first issue`](https://github.com/syedmuhdahmad/slopfence/labels/good%20first%20issue) or [`help wanted`](https://github.com/syedmuhdahmad/slopfence/labels/help%20wanted).
|
|
20
|
+
|
|
21
|
+
## Before you start coding
|
|
22
|
+
|
|
23
|
+
- **Small fixes** (typos, docs, obvious bugs): open a pull request directly.
|
|
24
|
+
- **Anything bigger** (new detectors, new features, behaviour changes): open an issue first and wait for a maintainer to agree on the approach. This avoids wasted work.
|
|
25
|
+
- Comment on an issue to say you're working on it, so others don't duplicate effort.
|
|
26
|
+
|
|
27
|
+
## Development workflow
|
|
28
|
+
|
|
29
|
+
`main` is protected: **nobody pushes to it directly**, maintainers included. All changes go through pull requests.
|
|
30
|
+
|
|
31
|
+
1. **Fork** the repository and clone your fork.
|
|
32
|
+
2. **Create a branch** from `main` with a descriptive name:
|
|
33
|
+
- `feat/slop001-pypi-lookup`
|
|
34
|
+
- `fix/false-positive-mock-assert`
|
|
35
|
+
- `docs/contributing-typo`
|
|
36
|
+
3. **Make your changes.** Keep each pull request focused on one thing.
|
|
37
|
+
4. **Add tests** for any behaviour change. Detectors need both:
|
|
38
|
+
- cases that **should** be flagged, and
|
|
39
|
+
- similar-looking cases that **should not** be flagged (false-positive guards).
|
|
40
|
+
5. **Run checks locally** (see below) and make sure they pass.
|
|
41
|
+
6. **Push** to your fork and **open a pull request** against `main`. Fill in the template.
|
|
42
|
+
|
|
43
|
+
### What happens to your pull request
|
|
44
|
+
|
|
45
|
+
- CI must pass.
|
|
46
|
+
- At least **one maintainer approval** is required.
|
|
47
|
+
- All review conversations must be resolved.
|
|
48
|
+
- Pull requests are **squash-merged**, so `main` has a clean, linear history with one commit per pull request. The pull request title becomes the commit message, so make it clear.
|
|
49
|
+
- Your branch is deleted automatically after merge.
|
|
50
|
+
|
|
51
|
+
## Local checks
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m venv .venv
|
|
55
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
56
|
+
pip install -e '.[dev]'
|
|
57
|
+
|
|
58
|
+
pytest # tests
|
|
59
|
+
ruff check . && ruff format --check .
|
|
60
|
+
slopfence src tests # slopfence must pass on its own code
|
|
61
|
+
npx markdownlint-cli2 "**/*.md" "!.venv/**"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Adding a detector
|
|
65
|
+
|
|
66
|
+
1. Add the rule to `RULES` in `src/slopfence/models.py`.
|
|
67
|
+
2. Write the detector in `src/slopfence/detectors/` and register it in `detectors/__init__.py`.
|
|
68
|
+
3. Add tests with **both** flagged and not-flagged cases. Real-world code that must stay quiet is the most valuable test.
|
|
69
|
+
4. Run it against a large codebase (for example your Python install's standard library) and check for false positives before opening the pull request.
|
|
70
|
+
|
|
71
|
+
## Commit and pull request style
|
|
72
|
+
|
|
73
|
+
- Use the imperative mood: "Add PyPI lookup cache", not "Added" or "Adds".
|
|
74
|
+
- Pull request titles follow [Conventional Commits](https://www.conventionalcommits.org/) style where it fits:
|
|
75
|
+
- `feat: add SLOP010 placeholder comment detector`
|
|
76
|
+
- `fix: ignore mocks used as fixtures in SLOP020`
|
|
77
|
+
- `docs: clarify ignore comment syntax`
|
|
78
|
+
- `chore: bump actions/checkout`
|
|
79
|
+
- Reference related issues: `Closes #12`.
|
|
80
|
+
|
|
81
|
+
## Writing a good detector
|
|
82
|
+
|
|
83
|
+
A detector is only useful if people trust it. Before proposing or writing one, check:
|
|
84
|
+
|
|
85
|
+
1. **Is it objective?** Could two reviewers agree on whether a given snippet matches?
|
|
86
|
+
2. **Is it high-confidence?** It's better to miss some cases than to flag correct code.
|
|
87
|
+
3. **Is it actionable?** The message should tell the user what's wrong and how to fix it.
|
|
88
|
+
4. **Is it about the pattern, not the author?** slopfence never tries to guess whether AI wrote the code.
|
|
89
|
+
|
|
90
|
+
## Licensing of contributions
|
|
91
|
+
|
|
92
|
+
By submitting a pull request, you agree that your contribution is licensed under the [MIT License](LICENSE), the same license as the project.
|
|
93
|
+
|
|
94
|
+
## Recognition
|
|
95
|
+
|
|
96
|
+
All contributors are credited in release notes. Thank you for helping make AI-assisted code better!
|