buildtools icon indicating copy to clipboard operation
buildtools copied to clipboard

buildifier is still printing errors to stderr even when `-format json` is used

Open aignas opened this issue 2 years ago • 0 comments

Given an invalid BUILD.bazel file:

Bad syntax

When running `buildifier as follows I get:

$ buildifier -lint=warn -mode check -warnings=all -format json BUILD.bazel
BUILD.bazel:1:11: syntax error near syntax
{"success":false,"files":[{"filename":"BUILD.bazel","formatted":false,"valid":false,"warnings":[]}]}

Right now the users attempting to write a parser for buildifier output have to write two parsers:

  • One for stdout that would be in JSON.
  • One for stderr that would be plain text.

This does not make it easy for users to write one. I would assume that most of the syntax error information could be surfaced to the user to provide easier to parse diagnostic messages.

For what people have to do currently, see https://github.com/mfussenegger/nvim-lint/pull/335

aignas avatar Jul 30 '23 14:07 aignas