Support warning on unused ignores without treating them as an error
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Feature
Mypy's --warn-unused-ignores option currently treats unused ignores as an error, rather than merely warning about them but still exiting zero.
Mypy should support an option where unused ignores are still warned about in the output, but are not treated as an error.
Current behavior:
❯ cat test.py
x = 1 + 1 # type: ignore
❯ mypy test.py
Success: no issues found in 1 source file
❯ mypy --strict test.py # exits nonzero
test.py:1: error: Unused "type: ignore" comment
Found 1 error in 1 file (checked 1 source file)
❯ mypy --strict --no-warn-unused-ignores test.py # exits zero
Success: no issues found in 1 source file
The current warn-unused-ignores behavior, where you have to choose between either erroring or total silence when there's an unused ignore (and can't actually just get a warning), could even be considered a bug.
Pitch
To preserve backward compatibility, perhaps something like this would work:
❯ mypy --unused-ignores=warning # emit a warning but don't exit nonzero
❯ mypy --unused-ignores=error # emit an error and exit nonzero, same as --warn-unused-ignores now
❯ mypy --warn-unused-ignores # same as --unused-ignores=error
❯ mypy --unused-ignores=none # no output, exit zero, same as --no-warn-unused-ignores now
❯ mypy --no-warn-unused-ignores # same as --unused-ignores=none
And the mypy -h usage output would just steer people toward using the new, less confusing options. Potentially using the old options could emit a message like "This option is deprecated, please use <new option> instead", if we may want to remove the confusing options at some point in the future.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
--warn-unused-ignores の例で示されているコマンドライン処理から始め、未使用の ignore に関する診断が終了ステータスにどのような影響を与えるかを追跡します。既存の flags を維持したまま、warning、error、disabled のモードを定義し、その後、各コマンドライン動作のカバレッジを追加して、文書化されている出力と終了コードを検証します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- cli, tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100