이 문서는 SonarQube v6.4 기반의 문서로 아카이브 되었습니다.
최신 문서를 참조하십시오.

Skip to end of metadata
Go to start of metadata

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

Compare with Current View Version History

« Previous Version 8 Next »

Table of Contents

SonarQube에서 제공하는 모든 메트릭을 다루지는 않습니다. 여러분이 사용하는 SonarQube 인스턴스에서 제공하는 전체 메트릭 리스트를 확인하고자 하는 경우 metrics search web service를 참조합니다.

복잡도(Complexity)

NameKeyDescription
Complexitycomplexity

코드이 경로를 기반으로 계산한 복잡도입니다. 소프트웨어 기능의 로직 흐름에 분기가 발생할 때마다, 복잡도 값은 1씩 증가합니다.

각 함수의 복잡도는 최소 1입니다. 각 프로그래밍 언어별로 키워드keyword 및 기능functionality가 상이하여, 복잡도 계산 정보는 약간 상이할 수 있습니다.

자세히 보기

Complexity /classclass_complexityclass 별 평균 복잡도
Complexity /filefile_complexityfile 별 평균 복잡도
Complexity /methodfunction_complexityfunction 별 평균 복잡도

문서화(Documentation)

NameKeyDescription
Comment linescomment_lines

실제 주석 혹은 주석 처리된 코드의 라인 수입니다.

의미 없는non-significant 코멘트 라인(빈 코멘트라인, 특수 문자만 존재한 라인 등)은 주석 라인 수를 증가시키지 않습니다.

다음 코드는 9 주석 라인을 포함하고 있습니다:

/**                                    +0 => 빈 주석 라인
 *                                     +0 => 빈 주석 라인
 * This is my documentation            +1 => 의미 있는 주석
 * although I don't                    +1 => 의미 있는 주석
 * have much                           +1 => 의미 있는 주석
 * to say                              +1 => 의미 있는 주석
 *                                     +0 => 빈 주석 라인
 ***************************           +0 => 의미 없는 주석
 *                                     +0 => 빈 주석 라인
 * blabla...                           +1 => 의미 있는 주석
 */                                    +0 => 빈 주석 라인
 
/**                                    +0 => 빈 주석 라인
 * public String foo() {               +1 => 주석 처리된 코드
 *   System.out.println(message);      +1 => 주석 처리된 코드
 *   return message;                   +1 => 주석 처리된 코드
 * }                                   +1 => 주석 처리된 코드
 */                                    +0 => empty comment line

더 자세히 보기

Comments (%)comment_lines_density

주석 라인 밀도 = 주석 라인 수 / (코드 라인 수 + 주석 라인 수) * 100

위의 식에 따라:

  • 50%: 코드 라인 수와 주석 라인 수가 동일함
  • 100%: 주석 라인 만 존재함
Public documented API (%)public_documented_api_density문서화 된 공용 API 밀도 = (공용 API 전체 수 - 문서화 되지 않은 공용 API 수) / 공용 API 전체 수 * 100
Public undocumented APIpublic_undocumented_api주석 헤더가 없는 공용 API 수
Commented-out LOCcommented_out_code_lines주석 처리 된 라인 수

코드 중복(Duplications)

NameKeyDescription

Duplicated blocks

duplicated_blocks

중복된 라인 블록의 수.

다음의 경우 중복된 블록으로 판단합니다:

  • Java 프로젝트 외:
    • 최소한 100개의 토큰이 연속적으로 중복되는 경우
    • 이 토큰들은 최소한 다음 범위에 퍼져 있어야 함:
      • COBOL: 30 코드 라인
      • ABAP: 20 코드 라인
      • 그 외: 10 코드 라인
  • Java 프로젝트:
    • 토큰 혹은 라인 수에 관계 없이, 최소 10개의 구분이 연속적으로 중복되는 경우

코드 중복 식별시, 들여쓰기(indentation) 및 스트링 문자열(string literal)는 검사 범위에서 제외합니다.

Duplicated filesduplicated_files중복과 연관된 파일 수
Duplicated linesduplicated_lines중복과 연관된 코드 라인 수
Duplicated lines (%)duplicated_lines_density

코드 중복 밀도 = 중복된 라인 수 / 전체 라인 수 * 100

이슈(Issues)

NameKeyDescription

New issues

new_violations

신규 이슈 수

New xxxxx issues

new_xxxxx_violations

xxxxx 심각도의 신규 이슈 수

(xxxxx는 blocker, critical, major, minor 혹은 info 임)

Issues

violations

이슈 전체 수

xxxxx issues

xxxxx_violations

xxxxx 심각도의 이슈 전체 수

(xxxxx는 blocker, critical, major, minor 혹은 info 임)

False positive issuesfalse_positive_issuesfalse positive 이슈 수
Open issuesopen_issuesOpen 상태의 이슈 수
Confirmed issuesconfirmed_issuesConfirmed 상태의 이슈 수
Reopened issuesreopened_issuesReopened 상태의 이슈 수

심각도(Severity)

Severity

Description

Blocker운영/보안 리스크(risk): 이 이슈는 실제 환경에서 운용되는 어플리케이션 전체를 불안정하게 만들 수 있습니다. 예: 가비지 컬렉터 호출, 소켓 닫지 않음 등
Critical운영 보안 리스크(risk): 이 이슈는 실제 환경에서 운용되는 어플리케이션 전체의 무결성(integrity)에 영향을 미칠 수 있는 예상치 못한 행동으로 이어질 수 있습니다. 예: NullPointerException, 잘못 처리한 익셉션, 단위 테스트 부족 등
Major이 이슈는 생산성(productivity)에 주요한(substantial) 영향을 미칠 수 있습니다. 예: 너무 복잡한 메소드, 패키지 사이클 등
Minor이 이슈는 생산성(productivity)에 잠재적이거나 미미한 영향을 미칠 수 있습니다. 예: 네이밍 컨벤션, finalizer가 상위 클래스의 finalizer를 호출하기만 하고 아무 동작도 하지 않는 등
Info이 이슈는 알려지지 않았거나 잘 정의되지 않은 보안 리스크 혹은 생산성에 대한 영향을 의미합니다.

유지보수성(Maintainability)

NameKeyDescription
Code Smellscode_smells코드 악취의 수.
New Code Smellsnew_code_smells신규 코드 악취의 수.
Maintainability Rating (formerly SQALE Rating)sqale_rating

기술 부채 비율(Technical Debt Ratio) 값에 따른 프로젝트 등급. 기본 유지보수성 등급(Maintainability Rating)은 그리드는 다음과 같습니다:

A=0~0.05, B=0.06~0.1, C=0.11~0.20, D=0.21~0.5, E=0.51~1

유지보수성 등급은 필요한 개선 비용(remediation cost)으로 대신 표현할 수 있습니다:

  • 5% 이하의 비용을 투입해야 할 경우, A등급에 해당합니다.
  • 6~10%의 비용을 투입해야 할 경우, B등급에 해당합니다.
  • 11~20%의 비용을 투입해야 할 경우, C등급에 해당합니다.
  • 21~50%의 비용을 투입해야 할 경우, D등급에 해다합니다.
  • 50% 초과 비용을 투입해야 할 경우, E등급에 해당합니다.
Technical Debtsqale_index모든 유지보수성 관련 이슈를 해결하기 위한 공수를 의미하며, 측정 값은 데이터베이스에 분 단위로 저장됩니다.
Technical Debt on new codenew_technical_debt신규 코드의 기술 부채(Technical Debt).
Technical Debt Ratiosqale_debt_ratio
소프트웨어 개발 비용과 수정 비용의 비율로, 기술 부채 비율(Technical Debt Ratio)은 다음 식에 따라 계산합니다:
	개선 비용(Remediation cost) / 개발 비용(Development cost) 
Which can be restated as:
	Remediation cost / (Cost to develop 1 line of code * Number of lines of code)
The value of the cost to develop a line of code is 0.06 days.
Technical Debt Ratio on new codenew_sqale_debt_ratio

Ratio between the cost to developer the code changed in the leak period and the cost of the issues linked to it.

품질 게이트(Quality Gates)

NameKeyDescription
Quality Gate Statusalert_statusState of the Quality Gate associated to your Project. Possible values are : ERROR, WARN, OK
Quality Gates Detailsquality_gate_detailsFor all the conditions of your Quality Gate, you know which condition is failing and which is not.

신뢰성(Reliability)

NameKeyDescription
BugsbugsNumber of bugs.
New Bugsnew_bugsNumber of new bugs.
Reliability Ratingreliability_rating

A = 0 Bug
B = at least 1 Minor Bug
C = at least 1 Major Bug
D = at least 1 Critical Bug
E = at least 1 Blocker Bug

Reliability remediation effortreliability_remediation_effortEffort to fix all bug issues. The measure is stored in minutes in the DB.
Reliability remediation effort on new codenew_reliability_remediation_effortSame as Reliability remediation effort by on the code changed in the leak period.

보안성(Security)

NameKeyDescription
VulnerabilitiesvulnerabilitiesNumber of vulnerabilities.
New Vulnerabilitiesnew_vulnerabilitiesNumber of new vulnerabilities.
Security Ratingsecurity_rating

A = 0 Vulnerability
B = at least 1 Minor Vulnerability
C = at least 1 Major Vulnerability
D = at least 1 Critical Vulnerability
E = at least 1 Blocker Vulnerability

Security remediation effortsecurity_remediation_effortEffort to fix all vulnerability issues. The measure is stored in minutes in the DB.
Security remediation effort on new codenew_security_remediation_effortSame as Security remediation effort by on the code changed in the leak period.

 

 

Metric

Key

Description

ClassesclassesNumber of classes (including nested classes, interfaces, enums and annotations).
DirectoriesdirectoriesNumber of directories.
FilesfilesNumber of files.
LineslinesNumber of physical lines (number of carriage returns).
Lines of codencloc

Number of physical lines that contain at least one character which is neither a whitespace or a tabulation or part of a comment.

More details

Lines of code per languagencloc_language_distributionNon Commenting Lines of Code Distributed By Language
Methodsfunctions

Number of functions. Depending on the language, a function is either a function or a method or a paragraph.

More details

ProjectsprojectsNumber of projects in a view.
Public APIpublic_api

Number of public Classes + number of public Functions + number of public Properties

More details

Statementsstatements

Number of statements.

More details

테스트(Tests)

Metric

Key

Description

Condition coveragebranch_coverage

불리언 표현식을 가진 모든 코드 라인에 대해, condition coverage는 매우 간단한 다음 질문을 던집니다:

"각 불리언 표편이 참과 거짓으로 평가되었는가?"

이것은 단위 테스트가 실행되는 동안 흐름 제어 구조에 존재할 수 있는 가능한 조건의 전부입니다.

Condition coverage = (CT + CF) / (2*B)
 
위 식에서
 
CT = 최소 1회 이상 "true"로 평가된 조건
CF = 최소 1회 이상 "false"로 평가된 조건
B = 조건의 총 합

Condition coverage on new codenew_branch_coverage

Condition coverage와 동일하며, 신규 혹은 업데이트 한 소스 코드에만 적용됩니다

Condition coverage hitsbranch_coverage_hits_data커버 된 조건 리스트
Conditions by lineconditions_by_line코드 라인 당 조건 수
Covered conditions by linecovered_conditions_by_line코드 라인 당 커버된 조건 후
Coveragecoverage

It is a mix of Line coverage and Condition coverage. Its goal is to provide an even more accurate answer to the following question: How much of the source code has been covered by the unit tests?

Coverage = (CT + CF + LC)/(2*B + EL)
 
where
 
CT = conditions that have been evaluated to 'true' at least once
CF = conditions that have been evaluated to 'false' at least once
LC = covered lines = lines_to_cover - uncovered_lines
 
B = total number of conditions
EL = total number of executable lines (lines_to_cover)

Coverage on new codenew_coverage

Identical to Coverage but restricted to new / updated source code.

Line coverageline_coverage

On a given line of code, Line coverage simply answers the following question: Has this line of code been executed during the execution of the unit tests?. It is the density of covered lines by unit tests:

Line coverage = LC / EL
 
where
 
LC = covered lines (lines_to_cover - uncovered_lines)
EL = total number of executable lines (lines_to_cover)

Line coverage on new codenew_line_coverageIdentical to Line coverage but restricted to new / updated source code.
Line coverage hitscoverage_line_hits_dataList of covered lines.
Lines to coverlines_to_coverNumber of lines of code which could be covered by unit tests (for example, blank lines or full comments lines are not considered as lines to cover).
Lines to cover on new codenew_lines_to_coverIdentical to Lines to cover but restricted to new / updated source code.
Skipped unit testsskipped_testsNumber of skipped unit tests.
Uncovered conditionsuncovered_conditionsNumber of conditions which are not covered by unit tests.
Uncovered conditions on new codenew_uncovered_conditionsIdentical to Uncovered conditions but restricted to new / updated source code.
Uncovered linesuncovered_linesNumber of lines of code which are not covered by unit tests.
Uncovered lines on new codenew_uncovered_linesIdentical to Uncovered lines but restricted to new / updated source code.
Unit teststestsNumber of unit tests.
Unit tests durationtest_execution_timeTime required to execute all the unit tests.
Unit test errorstest_errorsNumber of unit tests that have failed.
Unit test failurestest_failuresNumber of unit tests that have failed with an unexpected exception.
Unit test success density (%)test_success_densityTest success density = (Unit tests - (Unit test errors + Unit test failures)) / Unit tests * 100

The same kinds of metrics exist for Integration tests coverage and Overall tests coverage (Units tests + Integration tests).

Metrics on test execution do not exist for Integration tests and Overall tests.

  • No labels