Enum Name Not CamelCase

  • Query id: daaace5f-c0dc-4835-b526-7a116b7f4b4e
  • Query name: Enum Name Not CamelCase
  • Platform: GRPC
  • Severity: Info
  • Category: Best Practices
  • URL: Github

Description

All Enum Names should follow CamelCase and start with Capital Letter
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - proto file
syntax = "proto3" ;

enum noInitCap {
  option allow_alias = true ;
  UNKNOWN            = 0 ;
  STARTED            = 1 ;
  RUNNING            = 2[(custom_option) = "hello world"] ;
}

enum NOT_CAMEL_CASE {
  option allow_alias = true ;
  UNKNOWN            = 0 ;
  STARTED            = 1 ;
  RUNNING            = 2[(custom_option) = "hello world"] ;
}

message Testing {
  enum ALLCAPS {
    option allow_alias = true ;
    UNKNOWN            = 0 ;
    STARTED            = 1 ;
    RUNNING            = 2[(custom_option) = "hello world"] ;
  }
}

Code samples without security vulnerabilities

Negative test num. 1 - proto file
syntax = "proto3" ;

enum EnumAllowingAlias {
  option allow_alias = true ;
  UNKNOWN            = 0 ;
  STARTED            = 1 ;
  RUNNING            = 2[(custom_option) = "hello world"] ;
}