yoheimuta/protolint

Bug: Enum Field Prefix check

devops-42 opened this issue · 3 comments

Hi,

I currently face an issue when checking the following protofile enum declaration:

syntax = "proto3";
package foo.bar;


enum ITDepartmentRegion {

  IT_DEPARTMENT_REGION_UNSPECIFIED = 0;
  IT_DEPARTMENT_REGION_DE = 1;
  IT_DEPARTMENT_REGION_AT = 2;
  IT_DEPARTMENT_REGION_CH = 3;
}

When linting with yoheimuta I got an error:

EnumField name "IT_DEPARTMENT_REGION_UNSPECIFIED" should have the prefix "ITDEPARTMENT_REGION"
...

Meanwhile with buf:

Enum value name "ITDEPARTMENT_REGION_UNSPECIFIED" should be prefixed with "IT_DEPARTMENT_REGION_".
...

It seems, that the prefix calculation function has a glitch when trying to convert from camel-case strings starting with a 2-letter abbreviation.

Any chance to get a fix for that?

Cheers!

@devops-42 Thanks for bringing this issue to my attention. It definitely seems worth addressing.
I'll start working on it.

@devops-42 I've fixed it and released v0.46.1. Can you give it a try when you have a moment?

Hi @yoheimuta, thanks for investigating this. The version 0.46.1 fixed that problem 👍 (At least no more errors for my setup).