falsegreen 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 (36) hide show
  1. falsegreen-0.1.0/.claude-plugin/marketplace.json +20 -0
  2. falsegreen-0.1.0/.claude-plugin/plugin.json +11 -0
  3. falsegreen-0.1.0/.gitattributes +3 -0
  4. falsegreen-0.1.0/.github/CODEOWNERS +1 -0
  5. falsegreen-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  6. falsegreen-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  7. falsegreen-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  8. falsegreen-0.1.0/.github/dependabot.yml +24 -0
  9. falsegreen-0.1.0/.github/pull_request_template.md +44 -0
  10. falsegreen-0.1.0/.github/release-drafter.yml +54 -0
  11. falsegreen-0.1.0/.github/workflows/ci.yml +32 -0
  12. falsegreen-0.1.0/.github/workflows/release-drafter.yml +21 -0
  13. falsegreen-0.1.0/.github/workflows/release.yml +55 -0
  14. falsegreen-0.1.0/.gitignore +12 -0
  15. falsegreen-0.1.0/.pre-commit-hooks.yaml +8 -0
  16. falsegreen-0.1.0/CHANGELOG.md +46 -0
  17. falsegreen-0.1.0/CODE_OF_CONDUCT.md +83 -0
  18. falsegreen-0.1.0/CONTRIBUTING.md +107 -0
  19. falsegreen-0.1.0/LICENSE +21 -0
  20. falsegreen-0.1.0/PKG-INFO +416 -0
  21. falsegreen-0.1.0/README.md +395 -0
  22. falsegreen-0.1.0/RELEASE.md +51 -0
  23. falsegreen-0.1.0/SECURITY.md +62 -0
  24. falsegreen-0.1.0/docs/guide.md +587 -0
  25. falsegreen-0.1.0/pyproject.toml +38 -0
  26. falsegreen-0.1.0/requirements-dev.txt +5 -0
  27. falsegreen-0.1.0/skills/falsegreen/README.md +22 -0
  28. falsegreen-0.1.0/skills/falsegreen/SKILL.md +215 -0
  29. falsegreen-0.1.0/skills/falsegreen/examples/bad_tests_sample.py +96 -0
  30. falsegreen-0.1.0/skills/falsegreen/reference.md +178 -0
  31. falsegreen-0.1.0/skills/falsegreen/scripts/scan.py +1227 -0
  32. falsegreen-0.1.0/src/falsegreen/__init__.py +5 -0
  33. falsegreen-0.1.0/src/falsegreen/__main__.py +6 -0
  34. falsegreen-0.1.0/src/falsegreen/hook_install.py +131 -0
  35. falsegreen-0.1.0/src/falsegreen/scanner.py +1227 -0
  36. falsegreen-0.1.0/tests/test_scanner.py +790 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "falsegreen",
3
+ "owner": {
4
+ "name": "Vinicius Queiroz",
5
+ "url": "https://github.com/vinicq"
6
+ },
7
+ "metadata": {
8
+ "description": "Find unit tests that give false positives. Deterministic scanner plus a semantic pass that checks the expected value against intended behavior.",
9
+ "version": "0.1.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "falsegreen",
14
+ "source": "./",
15
+ "category": "testing",
16
+ "keywords": ["testing", "pytest", "test-quality", "false-positive", "code-review"],
17
+ "description": "Audit unit tests for false positives: green tests that protect nothing, and tests that pass while asserting the wrong expected value."
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "falsegreen",
3
+ "version": "0.1.0",
4
+ "description": "Audit unit tests for false positives. Judges the test's expected value against intended behavior (spec/contract), not just what the code returns.",
5
+ "author": { "name": "Vinicius Queiroz", "url": "https://github.com/vinicq" },
6
+ "homepage": "https://github.com/vinicq/falsegreen",
7
+ "repository": { "url": "https://github.com/vinicq/falsegreen" },
8
+ "license": "MIT",
9
+ "keywords": ["testing", "pytest", "test-quality", "false-positive", "code-review"],
10
+ "skills": ["./skills/falsegreen"]
11
+ }
@@ -0,0 +1,3 @@
1
+ * text=auto eol=lf
2
+ *.png binary
3
+ *.jpg binary
@@ -0,0 +1 @@
1
+ * @vinicq
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug report
3
+ about: A wrong result from falsegreen (false positive, false negative, or a crash)
4
+ title: ""
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## What happened
10
+
11
+ <!-- For a FALSE POSITIVE: paste the smallest test snippet that got wrongly
12
+ flagged, and the code falsegreen emitted (e.g. C13). -->
13
+ <!-- For a FALSE NEGATIVE: paste the bad test that slipped through. -->
14
+
15
+ ```python
16
+ # minimal test snippet
17
+ ```
18
+
19
+ ## What falsegreen reported
20
+
21
+ <!-- The exact output, including the case code(s). Paste `falsegreen <file>`
22
+ output or the relevant line. -->
23
+
24
+ ## What you expected
25
+
26
+ <!-- Flagged or not flagged, and why. For a false positive, why the snippet is
27
+ a legitimate test. -->
28
+
29
+ ## Environment
30
+
31
+ - falsegreen version (or commit SHA):
32
+ - Python version:
33
+ - OS:
34
+
35
+ ## Anything else
36
+
37
+ <!-- pytest plugins in play (pytest-mock, hypothesis), unittest vs pytest style, etc. -->
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Security report
4
+ url: https://github.com/vinicq/falsegreen/security/advisories/new
5
+ about: Report a vulnerability privately. Do not open a public issue.
6
+ - name: Question or idea
7
+ url: https://github.com/vinicq/falsegreen/discussions
8
+ about: Open-ended questions and discussion.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: A new detection rule, a config option, or another improvement
4
+ title: ""
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## The problem
10
+
11
+ <!-- What kind of false-positive test is escaping today, or what friction you hit. -->
12
+
13
+ ## Proposed rule or change
14
+
15
+ <!-- For a NEW detection rule: show the bad pattern it should catch, and a
16
+ legitimate look-alike it must NOT catch. State whether it should block (HIGH) or
17
+ only warn (LOW). Remember: HIGH must almost never fire on legitimate tests. -->
18
+
19
+ ```python
20
+ # bad pattern (should be flagged)
21
+
22
+ # legitimate look-alike (must stay clean)
23
+ ```
24
+
25
+ ## Alternatives considered
26
+
27
+ <!-- Existing tools (ruff PT rules, PyNose, mutmut) that already cover this? -->
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: pip
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ day: monday
8
+ open-pull-requests-limit: 5
9
+ labels:
10
+ - dependencies
11
+ commit-message:
12
+ prefix: "chore(deps)"
13
+
14
+ - package-ecosystem: github-actions
15
+ directory: /
16
+ schedule:
17
+ interval: weekly
18
+ day: monday
19
+ open-pull-requests-limit: 3
20
+ labels:
21
+ - dependencies
22
+ - ci
23
+ commit-message:
24
+ prefix: "chore(deps-ci)"
@@ -0,0 +1,44 @@
1
+ <!--
2
+ Thanks for sending a pull request. A few notes before you submit:
3
+
4
+ - Keep this PR small and focused. One logical change per PR.
5
+ - Three commits is the comfortable ceiling for review. Squash on merge is the
6
+ default, so you do not need to keep many commits.
7
+ - Tests are expected for every behaviour change. See CONTRIBUTING.md.
8
+
9
+ PR title must follow Conventional Commits: <type>(<scope>): <description>
10
+ Valid types: feat / fix / docs / refactor / test / chore / ci. Examples:
11
+
12
+ feat(scanner): detect skip() inside a broad except (C17)
13
+ fix(scanner): stop flagging len(x) == N as a weak check (C6)
14
+ -->
15
+
16
+ ## Summary
17
+
18
+ <!-- One or two sentences describing the change. -->
19
+
20
+ ## Changes
21
+
22
+ - ...
23
+
24
+ ## Test plan
25
+
26
+ - [ ] `pytest -q`
27
+ - [ ] `python -m falsegreen src tests` (the tool must stay clean on itself)
28
+ - [ ] `ruff check src tests`
29
+ - [ ] `diff src/falsegreen/scanner.py skills/falsegreen/scripts/scan.py` (identical)
30
+
31
+ ## Checklist
32
+
33
+ - [ ] A new/changed detection rule touches all four places: scanner logic,
34
+ `reference.md`, `docs/guide.md` (if a new case), and `tests/`.
35
+ - [ ] For a new rule: a test proves it fires on the bad pattern AND a test proves
36
+ it does NOT fire on the legitimate look-alike.
37
+ - [ ] HIGH-confidence codes were stress-tested against legitimate look-alikes
38
+ before being set to HIGH (they block commits).
39
+ - [ ] No `Co-Authored-By:` AI agent trailers in the commit history.
40
+ - [ ] Commit count is reasonable for review (rule of thumb: at most 3).
41
+
42
+ ## Related issues
43
+
44
+ <!-- Fixes #123, Refs #456 -->
@@ -0,0 +1,54 @@
1
+ # Release-drafter keeps a draft GitHub Release in sync with merged PRs on `main`.
2
+ # Each merge appends a line under the category matching one of the PR's labels.
3
+ # When you ship, bump the version on the draft and click Publish.
4
+ # The workflow that consumes this file is .github/workflows/release-drafter.yml.
5
+
6
+ name-template: "v$RESOLVED_VERSION"
7
+ tag-template: "v$RESOLVED_VERSION"
8
+
9
+ template: |
10
+ ## What's changed since $PREVIOUS_TAG
11
+
12
+ $CHANGES
13
+
14
+ **Full changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
15
+
16
+ categories:
17
+ - title: ":rocket: Features"
18
+ labels: [enhancement, feature]
19
+ - title: ":bug: Bug fixes"
20
+ labels: [bug, fix]
21
+ - title: ":lock: Security"
22
+ labels: [security]
23
+ - title: ":book: Documentation"
24
+ labels: [documentation, docs]
25
+ - title: ":hammer: Maintenance"
26
+ labels: [chore, dependencies, ci]
27
+
28
+ autolabeler:
29
+ - label: enhancement
30
+ title: ['/^feat(\(.+\))?!?:/']
31
+ - label: bug
32
+ title: ['/^fix(\(.+\))?!?:/']
33
+ - label: documentation
34
+ title: ['/^docs(\(.+\))?!?:/']
35
+ - label: chore
36
+ title: ['/^(chore|build|ci|refactor|test|perf|revert)(\(.+\))?!?:/']
37
+ - label: breaking-change
38
+ title: ['/^[a-z]+(\(.+\))?!:/']
39
+
40
+ change-template: "- $TITLE (#$NUMBER) by @$AUTHOR"
41
+ change-title-escapes: '\<*_&'
42
+
43
+ version-resolver:
44
+ major:
45
+ labels: [breaking-change, major]
46
+ minor:
47
+ labels: [enhancement, feature, minor]
48
+ patch:
49
+ labels: [bug, fix, security, documentation, docs, chore, dependencies, ci, patch]
50
+ default: patch
51
+
52
+ exclude-labels:
53
+ - skip-changelog
54
+ - no-release
@@ -0,0 +1,32 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.8", "3.11", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - uses: actions/setup-python@v6
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install -e ".[dev]"
23
+ - name: Lint
24
+ run: ruff check src tests
25
+ - name: Test
26
+ run: pytest -q
27
+ - name: Bundled skill scanner must match the package
28
+ run: diff -u src/falsegreen/scanner.py skills/falsegreen/scripts/scan.py
29
+ - name: Self-scan (must flag the demo, must not flag itself)
30
+ run: |
31
+ python -m falsegreen skills/falsegreen/examples/bad_tests_sample.py || true
32
+ python -m falsegreen src tests
@@ -0,0 +1,21 @@
1
+ name: release-drafter
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ types: [opened, reopened, synchronize]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ update_release_draft:
14
+ permissions:
15
+ contents: write
16
+ pull-requests: write
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: release-drafter/release-drafter@v6
20
+ env:
21
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,55 @@
1
+ name: release
2
+
3
+ # Builds the package and publishes it to PyPI via Trusted Publishing (OIDC).
4
+ # No API token: the publish job exchanges a short-lived OIDC identity with PyPI.
5
+ # Fires on a GitHub release being published, or manually for an existing tag.
6
+ #
7
+ # One-time human setup before the first run (see RELEASE.md / the issue):
8
+ # 1. PyPI: add a Trusted Publisher for project `falsegreen`
9
+ # (owner vinicq, repo falsegreen, workflow release.yml, environment pypi).
10
+ # 2. GitHub: create an environment named `pypi` (optionally tag-only + reviewer).
11
+
12
+ on:
13
+ release:
14
+ types: [published]
15
+ workflow_dispatch:
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
25
+ - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
26
+ with:
27
+ python-version: "3.13"
28
+ - name: Build sdist and wheel
29
+ run: |
30
+ python -m pip install --upgrade build twine
31
+ python -m build
32
+ python -m twine check dist/*
33
+ - name: Upload dist artifact
34
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
35
+ with:
36
+ name: dist
37
+ path: dist/
38
+ if-no-files-found: error
39
+
40
+ publish:
41
+ needs: build
42
+ runs-on: ubuntu-latest
43
+ environment: pypi
44
+ permissions:
45
+ id-token: write # OIDC: the only credential the publish step needs
46
+ steps:
47
+ - name: Download dist artifact
48
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
49
+ with:
50
+ name: dist
51
+ path: dist/
52
+ - name: Publish to PyPI
53
+ # Docker action: its ghcr.io image is tagged by release, not commit SHA,
54
+ # so a SHA pin fails to pull. release/v1 is the maintained, recommended ref.
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ .mypy_cache/
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ .venv/
10
+ venv/
11
+ .env
12
+ .handoff/
@@ -0,0 +1,8 @@
1
+ - id: falsegreen
2
+ name: falsegreen (false-positive scanner)
3
+ description: Flag unit tests that pass without protecting anything.
4
+ entry: falsegreen --staged
5
+ language: python
6
+ types: [python]
7
+ pass_filenames: false
8
+ require_serial: true
@@ -0,0 +1,46 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres
5
+ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-06-03
10
+
11
+ First release.
12
+
13
+ ### Added
14
+ - Deterministic AST scanner for Python/pytest (`falsegreen`, `python -m falsegreen`)
15
+ covering false-positive patterns across the semantic-logic families. HIGH codes
16
+ block a commit; LOW codes warn. Codes: C1 C2 C2b C3 C4 C4b C5 C6 C7 C8 C9 C13
17
+ C13b C14 C16 C17 C18 C19 C20 C21 CC. Each code carries a judgment tag (J1-J6).
18
+ - C18 (LOW): assertion comparing `str()`/`repr()`/an f-string of a value to a
19
+ string literal, which checks formatting instead of the value (Sensitive Equality).
20
+ - C19 (LOW): a `pytest.raises` block wrapping more than one statement, where an
21
+ earlier line can raise and the intended call is never reached.
22
+ - PyPI publishing via Trusted Publishing (OIDC) in `.github/workflows/release.yml`;
23
+ see `RELEASE.md`.
24
+ - Inline suppression (`# falsegreen: ignore[C8]`) and `--disable` flag.
25
+ - Project config: `[tool.falsegreen]` in `pyproject.toml` or `.falsegreen.toml`
26
+ (`disable`, `exclude`, per-code `severity`); precedence CLI > inline > config.
27
+ - Baseline / ratchet mode (`--baseline`, `--write-baseline`) with content
28
+ fingerprints that survive line shifts, for adopting on a legacy repo.
29
+ - Output formats: `--format {text,json,sarif,junit}`, `--summary`, `--output`.
30
+ SARIF 2.1.0 carries the judgment tag; `--summary` rolls up by code and judgment.
31
+ - C20 (HIGH): assertion in dead code after `return`/`raise`/`fail()`. C21 (LOW):
32
+ every assertion conditional, none runs unconditionally. Both from the rotten-
33
+ green-test line of work (Soares 2023).
34
+ - Claude Code skill (`/falsegreen`) for the semantic pass: judges a test's
35
+ expected value against intended behavior using an oracle hierarchy and a
36
+ test-intent classification step (catches cases 12 and 18).
37
+ - Distribution as a pip package, a `pre-commit` hook, and a Claude plugin.
38
+ - Plain-language guide (`docs/guide.md`), detection reference, and a demo file.
39
+
40
+ ### Validated
41
+ - Two real-project passes (bailiff, md-bridge) settled the rules and fixed three
42
+ false positives: C6 on called boolean predicates, C1 on literal-collection
43
+ loops, and C7 on `f() is f()` (the lru_cache / singleton identity test).
44
+
45
+ [Unreleased]: https://github.com/vinicq/falsegreen/compare/v0.1.0...HEAD
46
+ [0.1.0]: https://github.com/vinicq/falsegreen/releases/tag/v0.1.0
@@ -0,0 +1,83 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **vinicq@gmail.com**. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,107 @@
1
+ # Contributing to falsegreen
2
+
3
+ Thanks for helping. falsegreen finds unit tests that give false positives. The
4
+ bar for a contribution is simple: the tool itself must not become a false
5
+ positive. A new rule that cries wolf is worse than no rule.
6
+
7
+ ## 30-second cheat sheet
8
+
9
+ ```bash
10
+ git clone https://github.com/vinicq/falsegreen
11
+ cd falsegreen
12
+ pip install -e ".[dev]" # runtime has no deps; this adds pytest + ruff
13
+ pytest -q # run the test suite
14
+ python -m falsegreen src tests # the tool must stay clean on itself
15
+ ruff check src tests # lint
16
+ ```
17
+
18
+ Then branch, change, add a test, and open a pull request.
19
+
20
+ ## How the project is built
21
+
22
+ Two layers, one repo:
23
+
24
+ - **Scanner** (`src/falsegreen/scanner.py`): a zero-dependency AST pass. It parses
25
+ test files, it never imports or runs them. Each pattern is a case code
26
+ (`C1`, `C5`, `C13`, ...). HIGH-confidence codes block a commit; LOW only warn.
27
+ - **Skill** (`skills/falsegreen/`): the Claude Code semantic pass. It bundles a
28
+ byte-identical copy of the scanner at `skills/falsegreen/scripts/scan.py`; CI
29
+ fails if it drifts from `src/falsegreen/scanner.py`.
30
+
31
+ The plain-language rubric is `docs/guide.md`; the detection reference is
32
+ `skills/falsegreen/reference.md`.
33
+
34
+ ## Filing an issue
35
+
36
+ A useful bug report for a false positive includes the smallest test snippet that
37
+ gets wrongly flagged, the code falsegreen emitted, and what you expected. For a
38
+ false negative, show the bad test that slipped through. Use the demo file
39
+ `skills/falsegreen/examples/bad_tests_sample.py` as a format reference.
40
+
41
+ ## Adding or changing a detection rule
42
+
43
+ This is the most common contribution. A rule touches up to five places, and the
44
+ pull request needs all that apply:
45
+
46
+ 1. **Logic** in `src/falsegreen/scanner.py`. Decide HIGH vs LOW. The rule of
47
+ thumb: HIGH only if a legitimate test can almost never trigger it, because
48
+ HIGH blocks commits. When in doubt, ship it LOW.
49
+ 2. **Reference** entry in `skills/falsegreen/reference.md` (what it looks like,
50
+ why it fools you, confidence, the tool it maps to).
51
+ 3. **Guide** entry in `docs/guide.md` if it is a new case, in the same
52
+ real-world-analogy style as the others.
53
+ 4. **Tests** in `tests/test_scanner.py`: one test proving the rule fires on the
54
+ bad pattern, and at least one proving it does NOT fire on the legitimate
55
+ look-alike. The second test matters more than the first.
56
+ 5. **Skill prose** in `skills/falsegreen/SKILL.md`, *only if* the change alters a
57
+ confidence level, an exemption, a flag, or the operator's mental model. CI
58
+ byte-checks `scripts/scan.py` against the scanner, so detector *logic* is
59
+ mirrored automatically; the SKILL.md prose and its flag list are NOT, so they
60
+ must be kept consistent with `reference.md` and the README CLI section by hand.
61
+
62
+ Then run `pytest`, `python -m falsegreen src tests` (must stay clean), and
63
+ `diff src/falsegreen/scanner.py skills/falsegreen/scripts/scan.py` (must be
64
+ identical, copy the file if you changed the scanner).
65
+
66
+ ### The false-positive policy
67
+
68
+ falsegreen blocks commits, so precision beats recall. A rule that wrongly blocks
69
+ one legitimate test will get the whole tool disabled. Before promoting a rule to
70
+ HIGH, try to break it: parametrized tests, fixtures that assert, abstract base
71
+ test classes, `@patch`-injected mocks, helper functions. If any of those trips
72
+ it, keep it LOW or tighten the heuristic.
73
+
74
+ ## Tests are required
75
+
76
+ No behavior change merges without a test. The detector of false positives cannot
77
+ have any of its own. Every legitimate-code counter-example you can think of
78
+ should have a test asserting the scanner stays quiet on it.
79
+
80
+ ## Commit messages: Conventional Commits
81
+
82
+ Format: `type(scope): summary`. Recognised types: `feat`, `fix`, `docs`,
83
+ `test`, `refactor`, `chore`, `ci`. Examples:
84
+
85
+ ```
86
+ feat(scanner): detect skip() inside a broad except (C17)
87
+ fix(scanner): stop flagging len(x) == N as a weak check (C6)
88
+ docs(guide): add the bug-freezing case (18)
89
+ ```
90
+
91
+ Keep a pull request to roughly three commits. Squash noise before review.
92
+
93
+ ## Authorship and AI tooling
94
+
95
+ Use any tools you like, including AI assistants. But the authorship is yours.
96
+ Do not add `Co-Authored-By` trailers for AI agents, and do not add AI agents to
97
+ the contributor list. Human co-authors are welcome and encouraged.
98
+
99
+ ## License
100
+
101
+ By contributing, you agree that your contributions are licensed under the MIT
102
+ License (see `LICENSE`).
103
+
104
+ ## Code of conduct
105
+
106
+ This project follows the [Contributor Covenant](CODE_OF_CONDUCT.md). Be
107
+ respectful, assume good faith, report problems to `vinicq@gmail.com`.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vinicius Queiroz
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
13
+ all 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
21
+ THE SOFTWARE.