Hey all! Is there a way to pass a buf config file ...
# general
Hey all! Is there a way to pass a buf config file to buf linter (backend → pants.backend.codegen.protobuf.lint.buf) ? I’ve been trying to set:
Copy code
lint_args = [
  "--config buf.yaml"
and tried several paths, raw or with targets, without any success. It feels unlikely to work as protos are likely to be declared with
that does not accept any other file types than
. A workaround would be to pass the yaml (or json) content of the config file directly in the config option, but it’s not really maintainable as the config grows. Any idea?
Are you getting a specific error?
Yes, always
Failure: could not read file: open buf.yaml: no such file or directory
From what I understand, the linter expects to find the file in the sandbox, along with the proto files?
Yes. The buf rules would need to be updated to understand how to find an applicable config file and include it in the sandbox.
The pytest and scalafmt rules have examples of this.
Maybe open an issue? And include what the expected UX could be. Would it be a repo-wide config file? Or a config file for a subtree (like the scalafmt config)?
I.e., what are your expectations for the UX as a buf user.
Also useful to know is what is the UX for buf when it is used standalone.
I feel like we could have a generic
option within
in pants.toml (rather than lint_args and format_args) as the config in the yaml already expects a “lint” and “format” section. My current need is repo-wide indeed, but no strong opinion to be fair, I just don’t have any example where project-only config would be better. I have also tried to declare the config file into a
target, and add it to the dependencies of my
. I would expect it to be a strong information for pants’
goal to be able to discover the config file automatically, but not quite sure it’s supposed to behave like this. I’ll open an issue then!