Migrating from pyright to pyrefly for pre-commit silently turns off type checking for files outside `include`/`project-includes`
まだ誰も着手していません。
評価
調査の方向性
pyproject.toml、.pre-commit-config.yaml、および pre-commit run --all-files を使用して toy setup で不一致を再現し、test から直接実行した pyright および pyrefly check と比較します。pyrefly-typecheck-system hook が pre-commit から渡されたファイルをどのように処理するかを追跡します。完了条件は、pre-commit が project-includes と整合して foo のみをチェックし、bar もチェックしないことです。
索引モデルが issue の本文から書いたものです。
説明
If you migrate from pyrefly to pyright for pre-commit, it's very easy to accidentally turn off type checking for some directories. Here's a toy set-up, based on the set-up of a real-world project (pytorch/helion). Essentially, my project has two directories, foo and bar, and the type-checking config says to check only foo:
test/
|--pyproject.toml
|--.pre-commit-config.yaml
|--foo/
|--bar/
Here's the contents of pyproject.toml:
[tool.pyright]
include = ["foo"]
[tool.pyrefly]
project-includes = ["foo"]
And the contents of .pre-commit-config.yaml:
repos:
- repo: https://github.com/facebook/pyrefly-pre-commit
rev: 0.0.1
hooks:
- id: pyrefly-typecheck-system
name: Pyrefly (type checking)
- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.407
hooks:
- id: pyright
language: system
Running either pyright or pyrefly check inside test produces the same behavior: foo is checked. However, running pre-commit run --all-files causes pyright to check all files as specified, including the contents of bar. Pyrefly still checks only foo.
- 主要言語
- Python
- スター
- 37
- フォーク
- 5
- 平均マージ
- 3分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
似ている issue
-
Performance: deprecated DeviceEntry.config_entries access blocks the event loop for tens of secondsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
tuya/tuya_cloud_ha_bridge#14 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
semantica-agi/semantica#1968 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
agent: ready area: submission priority: high type: docs
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
dkritarth/scopewatch#213 ·
メンテナーはふだん 1 日以内に返信
-
Broken link in RELEASE.md対応中かも @Jah-yee が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
sphinx-contrib/httpdomain#143 ·
メンテナーはふだん 1 日以内に返信