[C#] SonarQube - 정적분석

728x90
반응형

 

개발을 할때 단순히 기능만 동작하는 코드를 만드는 것뿐만 아니라, 읽기 좋은 코드를 작성하려고

팀내에서 정형화된 코딩 규칙을 이용해 유지보수하기 좋은 코드 등을 만들기 위해 많은 노력을 합니다. 이를 위해 코드 리뷰 등을 통해 동료 개발자들이 직접 검토하는 경우도 있지만 정형화된 패턴에 대해서는 소스 코드를 분석해주는 도구를 이용할 수 있다. 이러한 것을 코드 정적 분석이라고 합니다.

 

몇가지 툴을 찾아본 결과 아래 SonarQube 라는 툴을 사용해보기로 하였습니다.

 

 

https://www.sonarsource.com/

 

Code Quality and Security | Developers First | SonarSource

Products First Our prime focus and dedication is in building great products that have an impact and are loved by their users. Developer-first Offering Our offering is built to first empower developers with code quality & security tooling, and then enable t

www.sonarsource.com

 


 

Visual Studio 설치

1. Visual Studio 설치 시 Market Place를 이용해서 설치 하였습니다. 도구 > 확장 및 업데이트 메뉴를 선택합니다. 

 

 

2.이후 나타나는 창에서 SonarLint 를 검색해 줍니다. 

 

 

3. 자세한 설치 방법은 아래 링크를 이용해 주세요.

https://improveandrepeat.com/2017/12/integrate-sonarqube-with-visual-studio-using-sonarlint/

 

Integrate SonarQube with Visual Studio using SonarLint

If you follow along with the last few posts on SonarQube, you will now have a working installation that continuously monitors the quality of your code. Today we link Visual Studio to SonarQube usin…

improveandrepeat.com

 


 

정적분석 적용 및 역활

SonarLint를 적용시키고, 현재 진행중인 프로젝트에 적용했을때 보여지는 경고 리스트 입니다. 

여러가지가 보여지네요.

SonarLint 에서는 경고를 띄우지만, 내부에서 결정한 코딩 규칙이 있다면, 무시하고 진행하시면 될 것 같습니다. 

 

자세한 내용은 아래 링크를 통해서 어떠한 내용을 분석해 주는지 확인하면 좋을 것 같습니다. 

https://rules.sonarsource.com/csharp

 

Rules explorer

 

rules.sonarsource.com

 

 

 

 

 

 

 

 

 

728x90