SQ Official Doc Link: https://docs.sonarqube.org/display/SONAR/Metric+Definitions
Table of Contents
SonarQube에서 제공하는 모든 메트릭을 다루지는 않습니다. 여러분이 사용하는 SonarQube 인스턴스에서 제공하는 전체 메트릭 리스트를 확인하고자 하는 경우 metrics search web service를 참조합니다.
복잡도(Complexity)
Name | Key | Description |
---|---|---|
Complexity | complexity | 코드이 경로를 기반으로 계산한 복잡도입니다. 소프트웨어 기능의 로직 흐름에 분기가 발생할 때마다, 복잡도 값은 1씩 증가합니다. 각 함수의 복잡도는 최소 1입니다. 각 프로그래밍 언어별로 키워드keyword 및 기능functionality가 상이하여, 복잡도 계산 정보는 약간 상이할 수 있습니다. |
Complexity /class | class_complexity | class 별 평균 복잡도 |
Complexity /file | file_complexity | file 별 평균 복잡도 |
Complexity /method | function_complexity | function 별 평균 복잡도 |
문서화(Documentation)
Name | Key | Description | |
---|---|---|---|
Comment lines | comment_lines | 실제 주석 혹은 주석 처리된 코드의 라인 수입니다. 의미 없는non-significant 코멘트 라인(빈 코멘트라인, 특수 문자만 존재한 라인 등)은 주석 라인 수를 증가시키지 않습니다. 다음 코드는 9 주석 라인을 포함하고 있습니다:
| |
Comments (%) | comment_lines_density | 주석 라인 밀도 = 주석 라인 수 / (코드 라인 수 + 주석 라인 수) * 100 위의 식에 따라:
| |
Public documented API (%) | public_documented_api_density | 문서화 된 공용 API 밀도 = (공용 API 전체 수 - 문서화 되지 않은 공용 API 수) / 공용 API 전체 수 * 100 | |
Public undocumented API | public_undocumented_api | 주석 헤더가 없는 공용 API 수 | |
Commented-out LOC | commented_out_code_lines | 주석 처리 된 라인 수 |
코드 중복(Duplications)
Name | Key | Description |
---|---|---|
Duplicated blocks | duplicated_blocks | 중복된 라인 블록의 수. 다음의 경우 중복된 블록으로 판단합니다:
코드 중복 식별시, 들여쓰기(indentation) 및 스트링 문자열(string literal)는 검사 범위에서 제외합니다. |
Duplicated files | duplicated_files | 중복과 연관된 파일 수 |
Duplicated lines | duplicated_lines | 중복과 연관된 코드 라인 수 |
Duplicated lines (%) | duplicated_lines_density | 코드 중복 밀도 = 중복된 라인 수 / 전체 라인 수 * 100 |
이슈(Issues)
Name | Key | Description |
---|---|---|
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 issues | false_positive_issues | false positive 이슈 수 |
Open issues | open_issues | Open 상태의 이슈 수 |
Confirmed issues | confirmed_issues | Confirmed 상태의 이슈 수 |
Reopened issues | reopened_issues | Reopened 상태의 이슈 수 |
심각도(Severity)
Severity | Description |
---|---|
Blocker | 운영/보안 리스크(risk): 이 이슈는 실제 환경에서 운용되는 어플리케이션 전체를 불안정하게 만들 수 있습니다. 예: 가비지 컬렉터 호출, 소켓 닫지 않음 등 |
Critical | 운영 보안 리스크(risk): 이 이슈는 실제 환경에서 운용되는 어플리케이션 전체의 무결성(integrity)에 영향을 미칠 수 있는 예상치 못한 행동으로 이어질 수 있습니다. 예: NullPointerException, 잘못 처리한 익셉션, 단위 테스트 부족 등 |
Major | 이 이슈는 생산성(productivity)에 주요한(substantial) 영향을 미칠 수 있습니다. 예: 너무 복잡한 메소드, 패키지 사이클 등 |
Minor | 이 이슈는 생산성(productivity)에 잠재적이거나 미미한 영향을 미칠 수 있습니다. 예: 네이밍 컨벤션, finalizer가 상위 클래스의 finalizer를 호출하기만 하고 아무 동작도 하지 않는 등 |
Info | 이 이슈는 알려지지 않았거나 잘 정의되지 않은 보안 리스크 혹은 생산성에 대한 영향을 의미합니다. |
유지보수성(Maintainability)
Name | Key | Description |
Code Smells | code_smells | 코드 악취의 수. |
New Code Smells | new_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)으로 대신 표현할 수 있습니다:
|
Technical Debt | sqale_index | 모든 유지보수성 관련 이슈를 해결하기 위한 공수를 의미하며, 측정 값은 데이터베이스에 분 단위로 저장됩니다. |
Technical Debt on new code | new_technical_debt | 신규 코드의 기술 부채(Technical Debt). |
Technical Debt Ratio | sqale_debt_ratio | 소프트웨어 개발 비용과 수정 비용의 비율로, 기술 부채 비율(Technical Debt Ratio)은 다음 식에 따라 계산합니다:
위 공식은 아래와 같이 변경할 수 있습니다:
코드 1 라인 개발 비용은 0.06일(day)입니다. |
Technical Debt Ratio on new code | new_sqale_debt_ratio | 릭 피리어드(leak period)에 변경된 코드를 개발하는 비용과 해당 코드에 관련된 이슈 처리 비용의 비율입니다. |
품질 게이트(Quality Gates)
Name | Key | Description |
---|---|---|
Quality Gate Status | alert_status | 프로젝트에 관련된 품질 게이트(Quality Gate)의 상태. ERROR , WARN 및 OK 값을 가집니다. |
Quality Gates Details | quality_gate_details | 모든 품질 게이트의 임계 조건(condition)에 대해, 각 조건의 성공 및 실패 상태를 확인할 수 있습니다. |
신뢰성(Reliability)
Name | Key | Description |
---|---|---|
Bugs | bugs | 버그 수. |
New Bugs | new_bugs | 신규 버그 수. |
Reliability Rating | reliability_rating | A = 버그 수 0개 |
Reliability remediation effort | reliability_remediation_effort | 모든 버그 이슈를 해결하기 위한 공수를 의미하며, 측정 값은 데이터베이스에 분 단위로 저장합니다. |
Reliability remediation effort on new code | new_reliability_remediation_effort | 릭 피리어드(leak period)에서 변경된 코드에 대한 신뢰성 개선 공수(Reliability remediation effort)와 동일합니다. |
보안성(Security)
Name | Key | Description |
---|---|---|
Vulnerabilities | vulnerabilities | 취약점(vulnerabilities) 수. |
New Vulnerabilities | new_vulnerabilities | 신규 취약점 수. |
Security Rating | security_rating | A = 취약점 0개 |
Security remediation effort | security_remediation_effort | 모든 취약점 이슈를 해결하기 위한 공수를 의미하며, 측정 값은 데이터베이스에 분 단위로 저장합니다. |
Security remediation effort on new code | new_security_remediation_effort | 릭 피리어드(leak period)에서 변경된 코드에 대한 보안성 개선 공수(Security remediation effort)와 동일합니다. |
Metric | Key | Description |
---|---|---|
Classes | classes | 클래스 수(중첩된 클래스(classes ), 인터페이스(interfaces ), 이넘(enums ) 및 애너테이션(annotations ) 포함). |
Directories | directories | 디렉토리 수. |
Files | files | 파일 수. |
Lines | lines | 물리적인 라인 수(캐리지 리턴(carriage returns) 수). |
Lines of code | ncloc | 공백(whitespace), 탭문자(tabulation) 혹은 주석의 일부가 아닌 문자를 최소한 한 문자 이상 포함한 물리적인 라인 수. |
Lines of code per language | ncloc_language_distribution | 언어별 비 주석 코드 라인 분포 |
Methods | functions | 함수 수. 프로그래밍 언어에 따라 함수( |
Projects | projects | 뷰의 프로젝트 수. |
Public API | public_api | 퍼블릭 클래스( |
Statements | statements | 구문(statement) 수. |
테스트(Tests)
Metric | Key | Description | |
---|---|---|---|
Condition coverage | branch_coverage | 불리언 표현식을 가진 모든 코드 라인에 대해, condition coverage는 매우 간단한 다음 질문을 던집니다: "각 불리언 표편이 참과 거짓으로 평가되었는가?" 이것은 단위 테스트가 실행되는 동안 흐름 제어 구조에 존재할 수 있는 가능한 조건의 전부입니다.
| |
Condition coverage on new code | new_branch_coverage | Condition coverage와 동일하며, 신규 혹은 업데이트 한 소스 코드에만 적용됩니다 | |
Condition coverage hits | branch_coverage_hits_data | 커버 된 조건 리스트 | |
Conditions by line | conditions_by_line | 코드 라인 당 조건 수 | |
Covered conditions by line | covered_conditions_by_line | 코드 라인 당 커버된 조건 후 | |
Coverage | coverage | 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 on new code | new_coverage | Identical to Coverage but restricted to new / updated source code. | |
Line coverage | line_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 on new code | new_line_coverage | 라인 커버리지(Line coverage)와 동일하나, 신규 및 업데이트 된 코드로 번위를 한정함. | |
Line coverage hits | coverage_line_hits_data | 커버된 라인 목록. | |
Lines to cover | lines_to_cover | 단위 테스트에 의해 커버된 코드 라인 수(예: 빈 라인 혹은 전체 주석 라인은 커버해야 할 라인으로 계산하지 않음). | |
Lines to cover on new code | new_lines_to_cover | 커버해야 할 라인의 수(Lines to cover)와 동일하나, 신규 및 업데이트 된 코드로 범위를 한정함. | |
Skipped unit tests | skipped_tests | 스킵한 단위 테스트 수. | |
Uncovered conditions | uncovered_conditions | 단위 테스트로 커버되지 않은 조건의 수. | |
Uncovered conditions on new code | new_uncovered_conditions | 커버되지 않은 조건의 수(Uncovered conditions)와 동일하나, 신규 및 업데이트 된 코드로 범위를 한정함. | |
Uncovered lines | uncovered_lines | 단위 테스트로 커버되지 않은 코드 라인 수. | |
Uncovered lines on new code | new_uncovered_lines | 커버되지 않은 라인 수(Uncovered lines)와 동일하나, 신규 및 업데이트 된 코드로 범위를 한정함. | |
Unit tests | tests | 단위 테스트 수. | |
Unit tests duration | test_execution_time | 모든 단위 테스트를 수행하기 위해 필요한 시간. | |
Unit test errors | test_errors | 실패한 단위 테스트 수. | |
Unit test failures | test_failures | 예상하지 않은 익셉션으로 실패한 단위 테스트 수. | |
Unit test success density (%) | test_success_density | 테스트 성공 밀도(Test 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.