python / python/mypy

`--enable-error-code code` does not enable some error codes, yet neither are they reported as an invalid error codes

オープン
#19,604 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug topic-configuration
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

説明

In my understanding, --enable-error-code unreachable should have the same effect as --warn-unreachable. But, instead, it seems to have no effect, and doesn't even produce an error.

$uvx mypy -c "if False: print('hello')"
Success: no issues found in 1 source file

$uvx mypy -c "if False: print('hello')" --warn-unreachable
<string>:1: error: Statement is unreachable  [unreachable]
Found 1 error in 1 file (checked 1 source file)

$uvx mypy -c "if False: print('hello')" --enable-error-code unreachable
Success: no issues found in 1 source file

$uvx mypy -c "if False: print('hello')" --enable-error-code unreachable --warn-unreachable
<string>:1: error: Statement is unreachable  [unreachable]
Found 1 error in 1 file (checked 1 source file)

$uvx mypy -c "if False: print('hello')" --enable-error-code funnyerrorcodenotreal
usage: mypy [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]
mypy: error: Invalid error code(s): funnyerrorcodenotreal

Based on my testing, this seems to have been the case since 1.0.0 and maybe before, and thus is not a recent regression.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、--enable-error-code と --warn-unreachable に対する mypy のコマンドライン処理から始め、issue の reproducer を最初の確認に使います。unreachable と無効なコードの挙動を比較し、その後、無効なコードは引き続き拒否される一方で、--warn-unreachable なしで unreachable を有効にできるよう、焦点を絞ったコマンドラインテストを追加または更新します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。