Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

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.urlSonarQube Server URLhttp://localhost:9000

프로젝트 환경 설정

Key

Description

Default value

sonar.projectKey

각 프로젝트가 고유하게 가지고 있는 key 값으로 다음의 문자열을 사용할 수 있습니다:

  • 숫자, 문자, '-' , '_' 및 '.'. 1자리 이상의 숫자가 포함되어야 합니다.

Maven을 사용하는 경우 key값은 자동으로 다음으로 설정됩니다: <groupId>:<artifactId>

 
sonar.sources

콤마(',')로 구분된 디렉토리 명칭을 입력할 수 있습니다.

Maven과 호환되나 그렇지 않은 경우 소스코드는 기본 Maven 코드 저장 위치에서 추출합니다.

 

선택 파라미터

프로젝트 식별

Key

Description

Default value

sonar.projectName

SonarQube 웹 인터페이스에 표시되는 프로젝트 이름. Maven 프로젝트인 경우 <name> 속성으로 설정합니다.

  • 속성을 명시하지 않은 경우 project key를 사용합니다
  • 동일한 이름이 데이터베이스에 존재하는 경우, 덮어쓰지 않습니다
sonar.projectVersion

프로젝트 버전. Maven 프로젝트인 경우 <version> 속성으로 설정합니다.

없음

인증

분석 수행권한이 없는 사용자로 로그인 한 경우, Execute Analysis 권한을 가진 사용자의 인증 정보를 입력해야 합니다.

Key

Description

Default value

sonar.loginExecute Analysis 권한을 가진 SonarQube 사용자의 로그인 계정 혹은 사용자 토큰. 
sonar.passwordsonar.login 사용자 계정의 비밀번호. 사용자 토큰을 사용하는 경우, 공란으로 남겨둡니다. 

웹 서비스

Key

Description

Default value

sonar.ws.timeout웹 소비스 콜의 최대 응답 대기시간(초) 60

프로젝트 설정

Key

Description

Default value

sonar.projectDescription

프로젝트 설명
<description> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다

 
sonar.links.homepage프로젝트 홈페이지 링크
<url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다.
 

sonar.links.ci

Continuous integration 
<ciManangement><url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다.
 
sonar.links.issue이슈 트래커
<issueManagement><url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다.
 
sonar.links.scm프로젝트 소스 링크
<scm><url> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다.
 
sonar.links.scm_dev

개발자 컨텍션 링크

<scm><developerConnection> 속성을 사용하는 Maven 프로젝트와 호환되지 않습니다.

 
sonar.tests

콤마(',')로 구분된 테스트 케이스 파일의 경로

Java Maven 프로젝트의 기본 경로 정보를 사용하는 Maven 프로젝트와 호환되지 않습니다.

 

sonar.language

분석 대상 소스 코드 언어 설정

지원 가능한 프로그래밍 언어 리스트는 Plugin Library 페이지(영문)을 참조합니다. 별도로 설정하지 않을 경우 multi-language 분석을 수행합니다.

 

sonar.sourceEncoding

소스 코드 파일 인코딩 설정

  • 예: UTF-8, MacRoman, Shift_JIS.

이 속성은 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)를 참조합니다(영문).

시스템 설정 인코딩

sonar.projectDate

분석 날짜 지정

Note: 이 속성은 특정한 유스케이스에서 활용할 수 있습니다:

  • 신규 프로젝트 분석 시, 해당 프로젝트의 코드 품질에 대한 히스토리 정보를 생성하고자 하는 경우
  • 데이터베이스 엔진 변경 시, 새로운 데이터베이스 스키마에서 데이터베이스 생성을 권장하나 이로 인해과거 프로젝트들에 대한 모든 정보를 유실할 수 있으며, 필요에 따라 새로운 SonarQube 데이터베이스에 필요한 히스토리 정보를 주입해야 하는 경우

위와 같은 유스 케이스에서 사용하고자 하는 경우 sonar.projectDate 속성을 활용할 수 있습니다. 해당 속성의 형식은 yyyy-mm-dd입니다(예: 2017-01-01).

프로세스는 아래와 같습니다:

  • 히스토리 이력을 생성하고자 하는 어플리케이션 소스의 가장 오래된 버전을 체크아웃합니다(특정 플래그 등).
  • SonarQube 분석을 해당 프로젝트에서 실행합니다. sonar.projectDate 속성을 설정합니다. 예: sonar-scaner -Dsonar.projectDate=2010-12-01
  • 어플리케이션 소스의 다음 버전을 체크아웃 한 뒤 sonar.projectDate 속성을 업데이트하고 분석을 수행합니다. 원하는 모든 버전의 소스 코드에 대해 동일한 작업을 반복합니다.

데이터베이스에 저장된 분석 결과 날짜 이전을 기준으 동일한 프로젝트를 분석할 수 없으며, 시간 순으로 분석할 수 있습니다. 따라서 오래된 버전일 수록 먼저 분석해야 합니다.
(warning)Note: 장기간의 이력 데이터를 생성하고자 하는 경우 저장소 정리 설정을 변경해야 할 수 있습니다.

현재 날짜

 sonar.branch

SCM 브랜치를 관리합니다.

(warning) SonarQube는 동일한 프로젝트의 두 브랜치를 다른 프로젝트로 취급하지 않기 때문에, Project A의 B1 브랜치에서 발견된 이슈는 Project A의 B2 브랜치의 이슈와 연결되지 않습니다. 현재 B1 브랜치에서 해결된 이슈를 B2 브랜치에서도 자동으로 해결되었다고 판단할 수 없게 됩니다.

Developer Cockpit 플러그인 사용자인 경우, Developer Cockpit Installation and Usage (영문)의 "Limitation" 섹션을 참조합니다.

 

sonar.profile

이 속성은 SonarQube 4.5 LTS에서 deprecation 되었으며, 더 이상 사용해서는 안됩니다(SONAR-5370 - Deprecate usage of "sonar.profile" as an analysis parameter CLOSED 참조).

해당 언어의 기본 프로파일

 

sonar.projectBaseDir

분석을 시작한 디렉토리가 아닌 다른 디렉토리에서 분석을 해야할 경우--즉, 분석은 jenkins/jobs/myjob/workplace에서 시작했으니 ftpdrop/cobol/project의 코드를 분석해야 하는 경우 등--에 이 속성을 사용합니다. 경로는 절대 경로 혹은 상대 경로를 모두 사용할 수 있습니다.

소스 디렉토리가 아닌 소스 디렉토리의 부모 디렉토리를 지정합니다. 이 속성에 지정한 디렉토리는 새로운 "분석 디렉토리(analysis directory)"로 간주되며, 모든 다른 경로는 sonar.projectBaseDir를 기준으로 설정됩니다.

분석 프로세스를 진행하기 위해서는 이 디렉토리에 쓰기 권한을 가지고 있어야 하며, 이 디렉토리에는 sonar.working.directory가 생성됩니다.

 
 sonar.working.directory

SonarQube Scanner 혹은 SonarQube Ant Task (버전 2.0 이상) 분석 시 사용할 작업 디렉토리를 지정합니다.

경로는 각 프로젝트 별로 상이하며, 고유해야 합니다.

(warning) 해당 폴더는 분석 시작 직전 삭제 됩니다.

.sonar
sonar.scm.provider
This 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. 
sonar.scm.forceReloadAllBy 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:

  • Exclude files from analysis
  • Prevent some files from being checked for duplications
  • Prevent some files from being taken into account for code coverage by unit tests and integration tests
  • Ignore issues on certain components and against certain coding rules 

Key

Description

Default value

sonar.inclusionsComma-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.exclusionsComma-delimited list of file path patterns to be excluded from analysis. 
sonar.coverage.exclusionsComma-delimited list of file path patterns to be excluded from coverage calculations 
sonar.test.exclusionsComma-delimited list of test file path patterns to be excluded from analysis. 
sonar.test.inclusionsComma-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.allfileFiles 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.exclusionsComma-delimited list of file path patterns to be excluded from duplication detection 

Duplications

KeyDescription

Default value

sonar.cpd.exclusions(see the Exclusions/Inclusions section) 
sonar.cpd.${language}.minimumtokensA piece of code is considered duplicated as soon as there are at least 100 duplicated tokens in a row (overide with sonar.cpd.${language}.minimumTokens) spread on at least 10 lines of code (override with sonar.cpd.${language}.minimumLines). For Java projects, a piece of code is considered as duplicated when there is a series of at least 10 statements in a row, regardless of the number of tokens and lines. This threshold cannot be overridden. 100
sonar.cpd.${language}.minimumLines10

 

Analysis Logging

Key

Description

Default value

sonar.log.level

Control the quantity / level of logs produced during an analysis.

DEBUG: 
Display INFO logs + more details at DEBUG level.
Similar to sonar.verbose=true

TRACE: 
Display DEBUG logs + the timings of all ElasticSearch queries and Web API calls executed by the SonarQube Scanner.

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 sonar.log.level=DEBUG.
  • Adds client-side environment variables and system properties to server-side log of analysis report processing. 
    NOTE There is the potential for this setting to expose sensitive information such as passwords if they are stored as server-side environment variables.
false
sonar.showProfiling

Display logs to see where the analyzer spends time.

This parameter is generating a file containing these timing infos in
<workingDir>/profiling/<moduleKey>-profiler.xml where <workingDir> is:

  • .sonar/profiling/ when analysis is run with Sonar Scanner

  • target/sonar/profiling/ when Maven is used 


false
sonar.scanner.dumpToFileOutputs 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 preview as part of PR analysis.

  • No labels