본문 바로가기
프로그래밍/JAVA

sonarQube - Field names should comply with a naming convention.

by 애플 로그 2022. 7. 22.
반응형

code smell - Field names should comply with a naming convention.

 

Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that field names match a provided regular expression.
Noncompliant Code Example
With the default regular expression ^[a-z][a-zA-Z0-9]*$:

 

sonarQube 정적분석에 code smell가 떠서 수정중에 있다.

문제

class MyClass {     private int my_field;  }  

 

해결책 

Compliant Solution
class MyClass {     private int myField;  }

 

필드명에 언더바를 빼라는 뜻이다.

my_field   => myField

댓글