Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
Table of Contents
|
프로젝트 분석 환경 설정을 위한 파라미터들은 다양한 위치에서 설정 가능합니다. 파라미터들은 다음과 같은 계층 구조를 가집니다:
- Global 분석 파라미터: UI에서 설정하며 모든 프로젝트에 적용됩니다(화면 최상단 bar 메뉴, Settings > General Settings).
- Project 분석 파라미터: UI에서 설정하며 global 파라미터의 설정 내용을 오버라이딩합니다(프로젝트 레벨, Configuration > Settings).
- Project 분석 파라미터: 프로젝트 분석 환경 설정 파일(sonar-project.properties) 혹은 분석 환경 파일(sonar.properties)에서 설정하며, UI에서 설정된 파라미터의 설정 내용을 오버라이딩합니다.
- Analysis / Command Line 파라미터: 분석 실행시 설정하며, project 분석 파라미터의 설정 내용을 오버라이딩 합니다.
UI에서 설정한 파라미터의 설정값들만 SonarQube 데이터 베이스에 저장됩니다.
예를 들어, `sonar.exclusions` 파라미터의 설정값을 커맨드 라인 명령어를 통해 오버라이딩해서 분석을 실행한 경우 해당 내용은 데이터베이스에 저장되지 않습니다. Eclipse를 통해 로컬 분석을 수행하는 경우, exclusion은 UI 상에서 설정되어 있기 때문에 해당 설정값는 데이터베이스에 저장됩니다.
본 섹션에서는 모든 파라미터를 기술하지 않습니다. 인터페이스에 표시되는 프로퍼티 키 역시 global, project 레벨 및 분석 파라미터로 설정할 수 있습니다
필수 파라미터
서버
Key | Description | Default value |
---|---|---|
sonar.host.url | SonarQube Server URL | http://localhost:9000 |
프로젝트 환경 설정
Key | Description | Default value |
---|---|---|
sonar.projectKey | 각 프로젝트가 고유하게 가지고 있는 key 값으로 다음의 문자열을 사용할 수 있습니다:
Maven을 사용하는 경우 key값은 자동으로 다음으로 설정됩니다: | |
sonar.sources | 콤마(',')로 구분된 디렉토리 명칭을 입력할 수 있습니다. Maven과 호환되나 그렇지 않은 경우 소스코드는 기본 Maven 코드 저장 위치에서 추출합니다. |
선택 파라미터
프로젝트 식별
Key | Description | Default value |
---|---|---|
sonar.projectName | SonarQube 웹 인터페이스에 표시되는 프로젝트 이름. Maven 프로젝트인 경우 < |
|
sonar.projectVersion | 프로젝트 버전. Maven 프로젝트인 경우 | 없음 |
인증
분석 수행권한이 없는 사용자로 로그인 한 경우, Execute Analysis 권한을 가진 사용자의 인증 정보를 입력해야 합니다.
Key | Description | Default value |
---|---|---|
sonar.login | Execute Analysis 권한을 가진 SonarQube 사용자의 로그인 계정 혹은 사용자 토큰. | |
sonar.password | sonar.login 사용자 계정의 비밀번호. 사용자 토큰을 사용하는 경우, 공란으로 남겨둡니다. |
웹 서비스
Key | Description | Default value |
---|---|---|
sonar.ws.timeout | 웹 소비스 콜의 최대 응답 대기시간(초) | 60 |
프로젝트 설정
Key | Description | Default value |
---|---|---|
sonar.projectDescription | 프로젝트 설명 | |
sonar.links.homepage | 프로젝트 홈페이지 링크 < url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
Continuous integration < ciManangement ><url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | ||
sonar.links.issue | 이슈 트래커 < issueManagement ><url > 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
sonar.links.scm | 프로젝트 소스 링크 < scm ><url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
sonar.links.scm_dev | 개발자 컨텍션 링크 < | |
sonar.tests | 콤마(',')로 구분된 테스트 케이스 파일의 경로 Java Maven 프로젝트의 기본 경로 정보를 사용하는 Maven 프로젝트와 호환되지 않습니다. | |
| 분석 대상 소스 코드 언어 설정 지원 가능한 프로그래밍 언어 리스트는 Plugin Library 페이지(영문)을 참조합니다. 별도로 설정하지 않을 경우 multi-language 분석을 수행합니다. |
|
| 소스 코드 파일 인코딩 설정
이 속성은 Maven 프로젝트의 project.build.sourceEncoding 속성으로 대체할 수 있습니다. 사용 가능한 인코딩은 JVM에 따라 상이합니다. 더 많은 정보는 http://docs.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html (column : Canonical Name for java.nio API)를 참조합니다(영문). | 시스템 설정 인코딩 |
| 분석 날짜 지정 Note: 이 속성은 특정한 유스케이스에서 활용할 수 있습니다:
위와 같은 유스 케이스에서 사용하고자 하는 경우 프로세스는 아래와 같습니다:
데이터베이스에 저장된 분석 결과 날짜 이전을 기준으 동일한 프로젝트를 분석할 수 없으며, 시간 순으로 분석할 수 있습니다. 따라서 오래된 버전일 수록 먼저 분석해야 합니다. ![]() | 현재 날짜 |
| SCM 브랜치를 관리합니다.
Developer Cockpit 플러그인 사용자인 경우, Developer Cockpit Installation and Usage (영문)의 "Limitation" 섹션을 참조합니다. |
|
| 이 속성은 SonarQube 4.5 LTS에서 deprecation 되었으며, 더 이상 사용해서는 안됩니다(SONAR-5370 - Deprecate usage of "sonar.profile" as an analysis parameter CLOSED 참조). | 해당 언어의 기본 프로파일 |
| 분석을 시작한 디렉토리가 아닌 다른 디렉토리에서 분석을 해야할 경우--즉, 분석은 jenkins/jobs/myjob/workplace에서 시작했으니 ftpdrop/cobol/project의 코드를 분석해야 하는 경우 등--에 이 속성을 사용합니다. 경로는 절대 경로 혹은 상대 경로를 모두 사용할 수 있습니다. 소스 디렉토리가 아닌 소스 디렉토리의 부모 디렉토리를 지정합니다. 이 속성에 지정한 디렉토리는 새로운 "분석 디렉토리(analysis directory)"로 간주되며, 모든 다른 경로는 분석 프로세스를 진행하기 위해서는 이 디렉토리에 쓰기 권한을 가지고 있어야 하며, 이 디렉토리에는 | |
sonar.working.directory | SonarQube Scanner 혹은 SonarQube Ant Task (버전 2.0 이상) 분석 시 사용할 작업 디렉토리를 지정합니다. 경로는 각 프로젝트 별로 상이하며, 고유해야 합니다. 해당 폴더는 분석 시작 직전 삭제 됩니다. | .sonar |
sonar.scm.providerThis | property can be used to explicitly tell SonarQube which SCM plugin should be used to grab SCM data on the project (in case auto-detection does not work). The value of this property is always lowercase and depends on the plugin (ex. "tfvc" for the TFVC plugin). Check the documentation page of each plugin to know more 이 속성을 사용해 명시적으로 SonarQube가 어떤 SCM 플러그임을 사용해 프로젝트에서 SCM 데이터를 취득해야 할지를 지정할 수 있습니다(auto-detection이 동작하지 않는 경우). 이 속성 값은 항상 소문자로 기록해야 하며 설치한 플러그인에 의존성을 가집니다(예: "tfvc"는 TFVC 플러그인을 의미함). 더 자세한 정보는 각 플러그인의 문서 페이지를 참조합니다. | |
sonar.scm.forceReloadAll | By default, blame information is only retrieved for changed files. Set this property to true to load blame information for all files. This can be useful is you feel that some SCM data is outdated but SonarQube does not get the latest information from the SCM engine. | false |
Exclusions / Inclusions
See Narrowing the Focus to:
기본적으로, 변경된 파일에 한해 블레임 정보(blame information)를 취득합니다. 이 속성을 | false |
Anchor exclude-include exclude-include
배제 및 포함
exclude-include | |
exclude-include |
분석 범위 좁히기를 참조해 다음을 확인합니다:
- 분석 대상에서 특정 파일 제외
- 중복 확인 대상에서 특정 파일 제외
- 단위 테스트 및 통합 테스트 커버리지 확인 대상에서 특정 파일 제외
- 특정 컴포넌트 혹은 특정 코딩 규칙 위반으로 인한 이슈 무시
Key | Description | Default value |
---|---|---|
sonar.inclusions Comma-delimited list of file path patterns to be included in analysis. When set, only files matching the paths set here will be included in analysis | 분석에 포함할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. 이 속성을 설정하면 설정된 경로에 해당하는 파일들만을 분석합니다. | |
sonar.exclusions Comma-delimited list of file path patterns to be excluded from analysis | 분석에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.coverage.exclusions Comma-delimited list of file path patterns to be excluded from coverage calculations | 커버리지 계산에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.test.exclusions Comma-delimited list of test file path patterns to be excluded from analysis | 분석에서 제외할 테스트 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. | |
sonar.test.inclusions Comma-delimited list of test file path patterns to be included in analysis. When set, only test files matching the paths set here will be included in analysis | 문석에 포함할 테스트 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. 이 속성을 설정하면 설정된 경로에 해당하는 테스트 파일만을 분석합니다. | |
sonar.issue.ignore.allfile | Files containing text matching this regular expression will be ignored by analysis 입력한 정규식에 매칭되는 파일들을 분석에서 제외합니다. | |
sonar.import_unknown_files | If set to true, all files are imported - with respect to inclusions and exclusions, even if there is no matching language plugin installed
| false |
sonar.cpd.exclusions Comma-delimited list of file path patterns to be excluded from duplication detection | 코드 중복 식별에서 제외할 파일 경로 패턴 목록으로, 콤마(,)로 구분합니다. |
코드 중복
Key | Description | Default value |
---|---|---|
sonar.cpd.exclusions ( | see the Exclusions/Inclusions section)배제 및 포함 섹션을 참조합니다. | |
sonar.cpd.${language}.minimumtokens | A piece of code is considered duplicated as soon as there are at least 100 duplicated tokens in a row (overide with 최소 10 라인(
minimumTokens 속성으로 변경 가능)의 중복된 토큰이 발생하는 경우, 해당 코드는 중복된 코드로 식별합니다. Java 프로젝트의 경우, 토큰이나 라인에 관계 없이 최소 10개의 구문이 연속적으로 중복되는 경우, 해당 코드는 중복된 코드로 식별합니다. | 100 |
sonar.cpd.${language}.minimumLines | 10 |
Analysis Logging
분석 로깅
Key | Description | Default value |
---|---|---|
sonar.log.level | Control the quantity / level of logs produced during an analysis분석 과정에서 생성하는 로그의 품질 / 레벨을 설정합니다. DEBUG: TRACE: | INFO |
sonar.verbose Add more detail to both client and server-side analysis logs. | Activates DEBUG mode for the scanner. This is a shortcut of 클라이언트 및 서버 사이드 분석 로그를 세부적으로 기록합니다.
| false |
sonar.showProfiling | Display logs to see where the analyzer spends time. This parameter is generating a file containing these timing infos in 이 속성을 true로 설정하면, 소요 시간 정보를 포함한 로그 파일인
| false |
sonar.scanner.dumpToFile | Outputs to the specified file the full list of properties passed to the scanner API as a means to debug analysis. |
Parameters specific to Integration
Those parameters are listed here for completeness of this documentation page - but regular users should not have to worry about them because they mainly target integration use cases인테그레이션에 한정된 파라미터
다음 파라미터들은 인테그레이션에 한정된 파라미터로, 일반 사용자의 경우 크게 신경쓰지 않아도 됩니다.
Key | Description |
---|---|
sonar.analysis.mode | This parameter is set to |