본문 바로가기

개발자/WPF(C#) UI

SonarLint로 정적 test 중 나오는 Warning 정리(1)

반응형

-Naming Rule에 따른 Warning

pascal case naming rule에 따르라고한다.

ex) 경고 S101 Rename struct 'Msgadapter2SIM_FAULT_STRUCT' to match pascal case naming rules, consider using 'Msgadapter2SimFaultStruct'. MC_SIMULATOR 

-Remove this unnecessary 'using'. 

어플리케이션 Producing하는데 아무런 변화가 없지만, 지우기를 권고한다.

 

-Remove this conditional structure or edit its code blocks so that they're not all the same. 

: Having all branches in a switch or if chain with the same implementation is an error. Either a copy-paste error was made and something different should be executed, or there shouldn't be a switch/if chain at all.

->조건문에 따라 실행되는게 똑같다면 조건문을 지워라.

 

-Remove the unnecessary Boolean literal(s).

: 필요없는 Boolean Literal(소스코드에 고정된 값) 없애라

 

-Merge this if statement with the enclosing one.

: Merging collapsible if statements increases the code's readability.

 

-Collapsible "if" statements should be merged

-Make ' .....' readonly.

readonly fields can only be assigned in a class constructor. If a class has a field that's not marked readonly but is only set in the constructor, it could cause confusion about the field's intended use. To avoid confusion, such fields should be marked readonly to make their intended use explicit, and to prevent future maintainers from inadvertently changing their use.

반응형