python / python/mypy

Mypy Does Not Return Non-Zero Exit Code for Invalid mypy.ini Values Followed by Comments, including 'strict'

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

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

bug
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Bug Report

Description

When using a comment in an mypy.ini file, it interferes with the parsing of boolean values, leading to unintended behavior. Specifically, if a boolean value is followed by a comment, mypy does not return a non-zero exit code, even if the value is invalid. This can lead to unexpected configuration changes and, in the example provided, turns off the 'strict' mode.

To Reproduce

[mypy]
strict = true # this comment turns strict off

Expected Behavior

Mypy should return a non-zero exit code when encountering invalid configuration values, even if they are followed by a comment.

Actual Behavior

Mypy outputs a warning but does not return a non-zero exit code, allowing the invalid configuration to take effect.

mypy.ini: [mypy]: strict: Not a boolean: true # this comment turns strict off

Your Environment

  • Mypy version used: 1.7.0, 1.8.0
  • Mypy command-line flags: ''
  • Mypy configuration options from mypy.ini (and other config files): n/a
  • Python version used: Python 3.10.11

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

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

はじめの一歩

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

調査の方向性

まず、提供された mypy.ini 設定で動作を再現し、mypy の設定解析および検証のエントリーポイントを追跡します。コメントに続くブール値のカバレッジを追加し、無効な値ではゼロ以外の終了コードが生成され、有効な値は変更されないことを確認します。

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

評価

技術スタック
python
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
58/100

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

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