bufbuild / buf

The best way of working with Protocol Buffers.
https://buf.build
Apache License 2.0
8.93k stars 267 forks source link

Set top-level `LintConfig` and `BreakingConfig` and use for image inputs #3111

Closed doriable closed 3 months ago

doriable commented 3 months ago

This PR exposes the top-level lint and breaking configs for buf.yaml files.

For v1 buf.yaml files, there is only ever one ModuleConfig, so the corresponding lint and breaking configs are used.

For v2 buf.yaml files, if a top-level lint and/or breaking config exists, then we return those. Otherwise, TopLevelLintConfig()/TopLevelBreakingConfig will return nil.

We use the top-level lint/breaking configs, if possible, with image inputs, since we cannot determine which specific v2 module config to use with images. In the case where there is no top-level config, we fall back to defaults.

Fixes #3080

doriable commented 3 months ago

I've also tested this against the user repro in the issue.