Check plugins cannot detect builtin rules that conflict with their own rules
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 12/100
調査の方向性
Start with multi_client.go, where CheckRequest.rule_ids is filtered per plugin, and with the rule.proto and check_service.proto definitions in bufbuild/bufplugin. The issue offers two designs (an enabled_rule_ids field, or conflicting_rule_ids on Rule) and no decision has been made, so the first step is a maintainer-agreed protocol design. Done means an agreed proto change plus enforcement at configuration time in buf.
索引モデルが issue の本文から書いたものです。
説明
Feature
I maintain a lint check plugin, buf-lint-extra, whose rules replace or contradict builtin rules:
PACKAGE_DIRECTORY_MATCH_EXTRAandDIRECTORY_SAME_PACKAGE_EXTRAare variants ofPACKAGE_DIRECTORY_MATCHandDIRECTORY_SAME_PACKAGEwith extra options. Running both the builtin and the plugin rule reports the same files with different expectations.FILE_LOWER_KEBAB_CASEcontradictsFILE_LOWER_SNAKE_CASE,PACKAGE_CAMEL_CASEcontradictsPACKAGE_LOWER_SNAKE_CASE, andENUM_DEDICATED_PACKAGE(last package component is the enum name) contradictsPACKAGE_VERSION_SUFFIX. With both sides enabled, every file fails one of the two.
All of these builtin rules are part of STANDARD, so anyone who adds the plugin to a STANDARD config hits the conflict. Today the only thing a plugin can do is document a lint.except list in its README and hope users copy it.
The plugin cannot detect the situation itself:
CheckRequest.rule_idsis filtered per client inmulti_client.go, so a plugin only ever sees its own rule IDs. The field's contract incheck_service.protosays all IDs must be IDs returned byListRules, so builtin IDs cannot be passed there without changing its meaning.- Nothing else in the request describes the lint configuration: there is no path to
buf.yaml, and a Wasm plugin has no filesystem or environment at all. A native plugin could walk up from the working directory looking forbuf.yaml, but that breaks with--config, with workspaces where each module has its ownlintsection, and would mean reimplementing category expansion andexcepthandling, and it still would not work for Wasm and BSR plugins.
Two ways to solve this, either one would be enough:
-
Tell plugins what else is enabled. A new field on
CheckRequest, sayrepeated string enabled_rule_ids, with every rule ID buf runs in this check across the builtin rules and all plugins, whilerule_idskeeps its current meaning. A plugin could then report or error out when it seesPACKAGE_DIRECTORY_MATCHnext toPACKAGE_DIRECTORY_MATCH_EXTRA, and could also adapt its behaviour to other rules. MyPACKAGE_DIRECTORY_MATCH_EXTRAalready changes its default depending on whetherENUM_DEDICATED_PACKAGEis inrule_ids, which only works because both rules live in the same plugin. -
Let plugins declare conflicts and have buf enforce them. A new field on
Ruleinrule.proto, sayrepeated string conflicting_rule_ids: IDs of rules, builtin or from other plugins, that must not be enabled together with this one. buf already checks rule and category ID uniqueness across plugins and hasreplacement_idsfor deprecated rules, so this would be one more declarative relation of the same kind. After resolvinguseandexcept, buf would fail (or warn) once, at configuration time, with a message pointing tolint.except, instead of users getting contradicting annotations on every file. This also covers conflicts between two unrelated plugins.
Option 2 is the better user experience, option 1 is more general. The protocol change belongs in bufbuild/bufplugin, but the enforcement and the request population are in buf, so filing here.
Seen with buf v1.73.0 and bufplugin-go v0.11.1.
- 主要言語
- Go
- スター
- 11.5k
- フォーク
- 376
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 21
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bufbuild/buf のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
-
Feature
難易度 3/5 1〜2日 初心者へのやさしさ 56/100
bufbuild/buf#4784 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
メンテナーはふだん 1 日以内に返信
-
Add a merge-base option to the buf-breaking check再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンFeature
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
bufbuild/buf#4495 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
bufbuild/buf#4425 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
ec2-subnet, security-group and internet-gateway skip all resources when one is deleted during the scan対応中かも @toabctl が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
gruntwork-io/cloud-nuke#1208 ·
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
snowflakedb/gosnowflake#1872 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
Linux 主机 macOS 主机
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Lee-xeo/Claude-Cage#1455 ·
メンテナーはふだん 1 日以内に返信