realpython / realpython/materials
Ruff lints the whole repo
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Jupyter Notebook
- Sterne
- 5.2k
- Forks
- 5.3k
- Ø Merge
- 4 T. 10 Std.
- Gemergte PRs (30 T.)
- 10
Beschreibung
ℹ️ 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
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit .github/workflows/linters.yaml und prüfe den bestehenden Schritt Check code style. Öffne anschließend einen Pull Request, um zu verifizieren, welche Dateien Ruff derzeit prüft. Aktualisiere den Workflow so, dass die Ruff-Formatierungs- und Lint-Befehle nur geänderte Python-Dateien erhalten, und bestätige, dass die Prüfung sauber übersprungen wird, wenn keine Python-Dateien geändert wurden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- github-actions, python
- Bereich
- ci-cd, tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 68/100