realpython / realpython/materials
Ruff lints the whole repo
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 5.2k
- Forks
- 5.3k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 10
Description
ℹ️ Please note that the best way to get support for Real Python courses & articles is to join one of our weekly Office Hours calls or in the RP Community Slack.
You can report issues and problems here, but we typically won't be able to provide 1:1 support outside the channels listed above.
Describe the bug
Currently, Ruff lints all the files in the repo, which can be inefficient.
To Reproduce
Steps to reproduce the behavior:
- Open a PR and take a look at the Ruff check details.
Expected behavior
Lint only the modified Python files.
Additional context
Proposed update to file .github/workflows/linters.yaml
- name: Check code style
run: |
. venv/bin/activate
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
git fetch origin ${{ github.base_ref }}
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...${{ github.sha }} -- '*.py')
else
CHANGED_FILES=$(git diff --name-only HEAD^ -- '*.py')
fi
if [ -n "$CHANGED_FILES" ]; then
python -m ruff format --check $CHANGED_FILES
python -m ruff check $CHANGED_FILES
fi
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with .github/workflows/linters.yaml and inspect the existing Check code style step, then open a pull request to verify which files Ruff currently checks. Update the workflow so the Ruff format and lint commands receive only modified Python files, and confirm the check skips cleanly when no Python files changed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, python
- Domain
- ci-cd, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100