Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Unclear how plugins should indicate a configuration failure

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

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

評価

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

調査の方向性

issue で参照されている src/flake8/plugins/manager.py の provide_options メソッドから始め、plugin parse_options の例外がコマンドラインインターフェースに到達するまでの経路を追跡してください。設定エラーをどのように報告すべきかを決める前に、既存のエラーハンドリング経路を確認してください。無効な plugin 設定によって、見苦しい traceback を表示せずに flake8 が早い段階で中止されれば完了です。

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

説明

In GitLab by @pjacock on Aug 6, 2019, 02:42

I have read http://flake8.pycqa.org/en/latest/plugin-development/plugin-parameters.html#accessing-parsed-options

I am working on a plugin which successfully sets and receives additional configuration values. However, I wish to validate the configuration once (as early as possible), and may need to indicate an error to flake8 signalling it to abort. The simple option of raising a ValueError within parse_options does not work gracefully:

...

    @classmethod
    def add_options(cls, parser):
        ...
        # Define option "--our_config_file"

    @classmethod
    def parse_options(cls, options):
        ...
        if not os.path.isfile(options.our_config_file):
            raise ValueError("Could not find specified file: %r" % options.our_config_file)

...

This has the desired effect of aborting flake8 early, but with an ugly traceback.

Is there an expected approach I have overlooked, or would documenting this with a try/except in flake8 be preferred?

I think the change would be in the provide_options method here:

https://gitlab.com/pycqa/flake8/blob/3.7.8/src/flake8/plugins/manager.py#L186

主要言語
Python
スター
3.8k
フォーク
356
平均マージ
3時間 25分
マージ済み PR(30日)
5

環境構築

はじめの一歩

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

PyCQA/flake8 のほかの issue

PyCQA/flake8 の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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