Ruff lints the whole repo

未關閉 適合新手
#729 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
68/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
github-actions, python
領域
ci-cd, tooling

研究方向

從 .github/workflows/linters.yaml 開始,檢查現有的 Check code style 步驟,然後開啟一個 pull request,以確認 Ruff 目前檢查哪些檔案。更新工作流程,使 Ruff 的格式化與 lint 指令只接收已修改的 Python 檔案,並確認在沒有 Python 檔案變更時檢查會正常略過。

由索引模型根據 Issue 內容生成。

描述

ℹ️ 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
主要語言
Jupyter Notebook
星號
5.2k
分支
5.3k
平均合併
4 天 10 小時
30 天內合併 PR
10

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

realpython/materials 的其他 Issue

查看 realpython/materials 的全部 Issue

相似的 Issue

更多 DevOps Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。