Skip to content

ci(lint): scope wemake-python-styleguide to changed .py files only#529

Merged
cgfixit merged 1 commit into
mainfrom
claude/scope-wps-lint-to-changed-files
Jul 13, 2026
Merged

ci(lint): scope wemake-python-styleguide to changed .py files only#529
cgfixit merged 1 commit into
mainfrom
claude/scope-wps-lint-to-changed-files

Conversation

@cgfixit

@cgfixit cgfixit commented Jul 13, 2026

Copy link
Copy Markdown
Owner

What

The wemake-python-styleguide job's filter_mode: added input only controls which findings get posted as inline PR comments — confirmed against the action's own action.yml: the actual lint scope (which files get linted, and whose exit code gates the job) is controlled entirely by the path input, which defaulted to . (the whole repo). Since the existing tree was never brought WPS-clean, every PR was failing on pre-existing findings in files it never touched — e.g. PR #528, a one-file docs change, failed on utils/personality.py, utils/ratelimit.py, and utils/sanitizer.py findings that predate it entirely.

Adds a step that computes the .py files changed vs the PR's actual target branch (main or cc, via github.event.pull_request.base.ref, falling back to main for the claude/** push trigger) using git merge-base + diff, and passes that file list to the action's path input instead. The WPS step is skipped entirely (via an if: condition) when no .py files changed — e.g. a docs-only PR like #528.

Ruff's own repo-wide check is untouched — the whole tree is expected to already be ruff-clean per CLAUDE.md §5, and it has passed clean on every PR observed so far.

Why

Per owner instruction: scope the new WPS lint gate to changed files only, so it stops blocking every PR (including docs-only ones) on pre-existing style debt in files they never touch.

Verification

  • YAML parses (yaml.safe_load).
  • Dry-ran the new bash logic directly against this repo, twice: the zero-diff case (HEAD vs itself) correctly yields no files and has_files=false; a synthetic one-file-changed branch correctly isolates exactly that one file.
  • Could not dry-run the Docker-based wemake-python-styleguide action itself in this sandbox — first real signal will be this PR's own CI run.

Risk to monitor

CI-config only, one file. If the merge-base/diff logic has an edge case this sandbox couldn't reproduce (e.g. a push event with a very divergent history), worst case is the WPS step errors or over/under-scopes — fail_workflow: '1' still gates the job either way, so it fails loud rather than silently passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K3WhoiUiUak84jUmiBhhvA


Generated by Claude Code

The wemake-python-styleguide job's filter_mode: added input only controls
which findings get posted as inline PR comments — it does not limit which
files are linted or which exit code gates the job (confirmed against the
action's own action.yml: the lint scope is entirely controlled by the path
input, which defaulted to '.', the whole repo). Since the existing tree was
never brought WPS-clean, every PR was failing on pre-existing findings in
files it never touched (e.g. PR #528, a one-file docs change, failed on
utils/personality.py, utils/ratelimit.py, utils/sanitizer.py findings).

Adds a step that computes the .py files changed vs the PR's actual target
branch (main or cc, via github.event.pull_request.base.ref, falling back to
main for the claude/** push trigger) using git merge-base + diff, and passes
that file list to the action's path input. The WPS step is skipped entirely
via an if: condition when no .py files changed (e.g. a docs-only PR).

Ruff's own repo-wide check is untouched — the whole tree is expected to
already be ruff-clean per CLAUDE.md, and it already passed clean on every
PR observed so far.

Verified: YAML parses; dry-ran the new bash logic directly against this
repo twice — zero-diff case (HEAD vs itself) correctly yields no files, and
a synthetic one-file-changed branch correctly isolates exactly that file.
Could not dry-run the Docker-based wemake action itself in this sandbox.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3WhoiUiUak84jUmiBhhvA
@cgfixit cgfixit marked this pull request as ready for review July 13, 2026 22:55
@cgfixit cgfixit merged commit 672621b into main Jul 13, 2026
31 checks passed
@cgfixit cgfixit deleted the claude/scope-wps-lint-to-changed-files branch July 13, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants