ci(lint): scope wemake-python-styleguide to changed .py files only#529
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
wemake-python-styleguidejob'sfilter_mode: addedinput only controls which findings get posted as inline PR comments — confirmed against the action's ownaction.yml: the actual lint scope (which files get linted, and whose exit code gates the job) is controlled entirely by thepathinput, 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 onutils/personality.py,utils/ratelimit.py, andutils/sanitizer.pyfindings that predate it entirely.Adds a step that computes the
.pyfiles changed vs the PR's actual target branch (mainorcc, viagithub.event.pull_request.base.ref, falling back tomainfor theclaude/**push trigger) usinggit merge-base+diff, and passes that file list to the action'spathinput instead. The WPS step is skipped entirely (via anif:condition) when no.pyfiles 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.safe_load).has_files=false; a synthetic one-file-changed branch correctly isolates exactly that one file.wemake-python-styleguideaction 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
pushevent 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