nilslice / protolock

Protocol Buffer companion tool. Track your .proto files and prevent changes to messages and services which impact API compatibility.
https://protolock.dev
BSD 3-Clause "New" or "Revised" License
605 stars 37 forks source link

False positive in camelCase naming violation for EnumValueOptions builtin #150

Open midsbie opened 1 year ago

midsbie commented 1 year ago

I've encountered an issue with protolock's handling of EnumValueOptions in Protobuf, which seems to be a false positive and might represent bug(s) in the tool.

Specifically, protolock is flagging a camel case naming violation for EnumValueOptions, a built-in Protobuf symbol (documentation). Given that this is a standard, predefined Protobuf entity, it should not be subject to camel case violation checks. This false positive is misleading and contradicts Protobuf's standard naming conventions.


Example:

syntax = "proto3";

import "google/protobuf/descriptor.proto";

package foo.v1;

extend google.protobuf.EnumValueOptions {
  string display_name = 10001;
}

Produces:

CONFLICT: Message google.protobuf.EnumValueOptions is not CamelCase (wih an initial capital)

Only way I found of "resolving" the error was to add a skip hint:

// @protolock:skip
extend google.protobuf.EnumValueOptions {
  ...
nilslice commented 11 months ago

Thanks @miguel-guedes -- I have a short list of little maintenance issues I'll hopefully tackle over the holiday break. Will add this to the list!

I agree this may be a bit over-eager to report as an issue. If you wanted to contribute a fix for this, please let me know. Otherwise, I'll get to it asap :)