prototool
prototool copied to clipboard
lint output can have incorrect or missing line numbers
My environment:
$ prototool version
Version: 1.8.0
Default protoc version: 3.8.0
Go version: go1.12.6
OS/Arch: darwin/amd64
With an example.proto:
syntax = "proto3";
message Example {
enum Foo {
FOO_INVALID = 1; // Wrong, enums start at zero
}
}
Example 1:
$ prototool lint example.proto
example.proto:1:1:The first enum value must be zero in proto3.
I think the numbers should be line 5 and column 5?
Example 2:
$ prototool lint --json example.proto
{"filename":"example.proto","message":"The first enum value must be zero in proto3."}
For the JSON output, line number is missing entirely.
There's another case which I'm not sure about (it could be the same bug or something else entirely).
With an example.proto (which does compile, oddly enough):
syntax = "proto3";
message Example // comment before brace
{
enum Foo {
FOO_INVALID = 1; // Wrong, enums start at zero
}
}
Now I get:
$ prototool lint example.proto
example.proto:5:17: found "// comment before brace" but expected [message opening {]
Correct line and column this time, however...
$ prototool lint --json example.proto
example.proto:5:17: found "// comment before brace" but expected [message opening {]
The output is the same, rather than being in the expected JSON format.
I will try and look into the code later if I get a chance.
Thanks for filing, I will take a look.