realpython / realpython/materials

Ruff lints the whole repo

Aperta Adatta ai principianti
#729 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Jupyter Notebook
Stelle
5.2k
Fork
5.3k
Merge medio
4g 10h
PR unite (30g)
10

Descrizione

ℹ️ 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:

  1. 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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con .github/workflows/linters.yaml e ispeziona il passaggio esistente Check code style, quindi apri una pull request per verificare quali file controlla attualmente Ruff. Aggiorna il workflow in modo che i comandi di formattazione e lint di Ruff ricevano solo i file Python modificati e conferma che il controllo venga saltato correttamente quando non è stato modificato alcun file Python.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github-actions, python
Ambito
ci-cd, tooling
Tipo di issue
Bug
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.