다운로드 할 것들 정리
해당문서 작성시 sonar-cxx 가 지원되는 sonarqube의 버전은 6.3.1 이었다.
SonarQube 6.3.1
sonar-cxx
- github
https://github.com/SonarOpenCommunity - 적용 가능한 소나큐브 버전 정리
https://github.com/SonarOpenCommunity/sonar-cxx/wiki/SonarQube-compatibility-matrix
sonar-cppcheck-plugin
cppcheck
- http://cppcheck.sourceforge.net/
스캐너 다운
플러그인(cppcheck, sonar-cxx) 셋팅
D:\sonarqube\sonarqube-6.3.1\extensions\plugins 폴더에 다운받은 플러그인을 두개 복사시켜 놓는다.
압출 풀고 실행
소나큐브실행
경로 : D:\sonarqube\sonarqube-6.3.1\bin\windows-x86-64\StartSonar.bat
디폴트 주소는 http://localhost:9000 이고, 계정은 admin/admin 이다.
스캐너 압출 풀고 실행하기 전에 설정 먼저 설정!
설정 파일 경로 : D:\sonarqube\sonar-scanner-3.0.3.778-windows\conf\sonar-scanner.properties
21 번째 라인의
"sonar.projectBaseDir=D:\sonarqube\cppTestProject\ #반드시 절대 경로를 적어야 한다.!!!"
에 주의하자!!!!
#Configure here general information about the environment, such as SonarQube DB details for example #No information about specific project should appear here #----- Default SonarQube server #sonar.host.url=http://localhost:9000 #----- Default source code encoding #sonar.sourceEncoding=UTF-8 # required metadata sonar.projectKey=test sonar.projectName=test sonar.projectVersion=1.0 # path to source directories (required) sonar.projectBaseDir=D:\sonarqube\cppTestProject\ #반드시 절대 경로를 적어야 한다.!!! sonar.sources=./cppTestProject # Uncomment this line to analyse a project which is not a java project. # The value of the property must be the key of the language. sonar.language=c++ sonar.cxx.cppcheck.reportPath=./cppcheck_report.xml
스캐너를 돌리기 전에 cppcheck 먼저 돌리자
이후 모든 명령어는 testProject 루트 폴더에서 명령을 실행한다.
명령어를 실행할 경로
D:\sonarqube\cppTestProject
실행
cppcheck 돌릴 때 반드시 powershell 이 아닌 cmd(명령프롬프트) 에서 실행하는 편이 정신건강에 좋다(리다이렉션이 잘 먹지 않아서...)
D:\sonarqube\cppTestProject>"C:\Program Files\Cppcheck\cppcheck.exe" -DWin64 --xml-version=2 --enable=all --platform=win64 --language=c++ -I .\ .\cppTestProject 2> cppcheck_report.xml
스캐너 실행
PS D:\sonarqube\cppTestProject> D:\sonarqube\sonar-scanner-3.0.3.778-windows\bin\sonar-scanner.bat
결과 예시
'IT > CI' 카테고리의 다른 글
Sonarqube 관련 문제 해결 (0) | 2017.09.07 |
---|