Documentation Metrics


All metrics used in the quality model are described thereafter, with useful information and references. They are classified according to their source. Please note also that several other metrics may be retrieved but not used in the quality model.



  • Number of comment lines ( SQ_COMMENT_LINES )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 1000 ≤ 3 < 10000 ≤ 4 < 50000 ≤ 5

    Number of lines containing either comment or commented-out code.

    Non-significant comment lines (empty comment lines, comment lines containing only special characters, etc.) do not increase the number of comment lines.

    For Java, file headers are not counted as comment lines (as they usually define the license).

    Lines containing the following instructions are counted both as comments and lines of code: AUTHOR, INSTALLATION, DATE-COMPILED, DATE-WRITTEN, SECURITY.

  • Comment lines density ( SQ_COMR )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 10 ≤ 2 < 20 ≤ 3 < 30 ≤ 4 < 40 ≤ 5

    Density of comment lines = Comment lines / (Lines of code + Comment lines) * 100.

    With such a formula, 50% means that the number of lines of code equals the number of comment lines and 100% means that the file only contains comment lines

  • Commented code ( SQ_COM_CODE )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 40 ≤ 2 < 30 ≤ 3 < 20 ≤ 4 < 10 ≤ 5

    Commented lines of code

    See more information about commented code on SonarQube doc web site. There is a well-documented debate on Stack Overflow as well.

  • Test coverage ( SQ_COVERAGE )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 10 ≤ 2 < 20 ≤ 3 < 40 ≤ 4 < 50 ≤ 5

    Overall test coverage.

  • Branch coverage ( SQ_COVERAGE_BRANCH )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 10 ≤ 2 < 20 ≤ 3 < 40 ≤ 4 < 50 ≤ 5

    Branch test coverage.

  • Line coverage ( SQ_COVERAGE_LINE )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 10 ≤ 2 < 20 ≤ 3 < 40 ≤ 4 < 50 ≤ 5

    Line test coverage.

  • Total complexity ( SQ_CPX )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < ≤ 2 < ≤ 3 < ≤ 4 < ≤ 5

    It is the complexity calculated based on the number of paths through the code. Whenever the control flow of a function splits, the complexity counter gets incremented by one. Each function has a minimum complexity of 1. This calculation varies slightly by language because keywords and functionalities do.

    For more information on line counting for each language, see https://docs.sonarqube.org/display/SONAR/Metrics+-+Complexity.

  • File complexity ( SQ_CPX_FILE_IDX )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 10 ≤ 2 < 20 ≤ 3 < 30 ≤ 4 < 40 ≤ 5

    Average complexity by file.

  • Duplicated lines (%) ( SQ_DUPLICATED_LINES_DENSITY )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 40 ≤ 2 < 30 ≤ 3 < 20 ≤ 4 < 10 ≤ 5

    Density of duplication = Duplicated lines / Lines * 100.

  • Number of files ( SQ_FILES )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 100 ≤ 2 < 500 ≤ 3 < 1000 ≤ 4 < 5000 ≤ 5

    The total number of files analysed.

  • Number of functions ( SQ_FUNCS )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 300 ≤ 2 < 500 ≤ 3 < 3000 ≤ 4 < 5000 ≤ 5

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

    For Java, constructors are considered as methods and accessors are considered as methods if the sonar.squid.analyse.property.accessors property is set to false.

    For Cobol, it is the number of paragraphs.

  • Number of lines of code ( SQ_NCLOC )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 1000 ≤ 3 < 10000 ≤ 4 < 50000 ≤ 5

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

    For Cobol, generated lines of code and pre-processing instructions (SKIP1, SKIP2, SKIP3, COPY, EJECT, REPLACE) are not counted as lines of code.

  • Public API ( SQ_PUBLIC_API )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 1000 ≤ 3 < 5000 ≤ 4 < 10000 ≤ 5

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

  • Public documented API (%) ( SQ_PUBLIC_API_DOC_DENSITY )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 40 ≤ 2 < 30 ≤ 3 < 20 ≤ 4 < 10 ≤ 5

    Density of public documented API = (Public API - Public undocumented API) / Public API * 100

  • Technical debt ( SQ_SQALE_INDEX )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 5000 ≤ 2 < 1000 ≤ 3 < 500 ≤ 4 < 100 ≤ 5

    Effort to fix all maintainability issues. The measure is stored in minutes in the DB.

  • Maintainability rating ( SQ_SQALE_RATING )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 0.05 ≤ 2 < 0.1 ≤ 3 < 0.2 ≤ 4 < 0.5 ≤ 5

    Rating given to your project related to the value of your Technical Debt Ratio. The default Maintainability Rating grid is: A=0-0.05, B=0.06-0.1, C=0.11-0.20, D=0.21-0.5, E=0.51-1.

    The Maintainability Rating scale can be alternately stated by saying that if the outstanding remediation cost depends on the time that has already gone into the application: A <=5% , B between 6 to 10%, C between 11 to 20%, D between 21 to 50%, and anything over 50% is an E.

  • Number of statements ( SQ_STATEMENTS )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 1000 ≤ 3 < 10000 ≤ 4 < 50000 ≤ 5

    Number of statements.

    For Java, it is the number of statements as defined in the Java Language Specification but without block definitions. Statements counter gets incremented by one each time a following keyword is encountered: if, else, while, do, for, switch, break, continue, return, throw, synchronized, catch, finally..

    Statements counter is not incremented by a class, method, field, annotation definition, package declaration and import declaration.

    For Cobol, a statement is one of move, if, accept, add, alter, call, cancel, close, compute, continue, delete, display, divide, entry, evaluate, exitProgram, goback, goto, initialize, inspect, merge, multiply, open, perform, read, release, return, rewrite, search, set, sort, start, stop, string, subtract, unstring, write, exec, ibmXmlParse, ibmXmlGenerate, readyReset, mfCommit, mfRollback.

  • Number of blocker issues ( SQ_VIOLATIONS_BLOCKER )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 100 ≤ 2 < 50 ≤ 3 < 10 ≤ 4 < 1 ≤ 5

    The total number of issues (violations) found by SonarQube with a severity equal to BLOCKER.

  • Number of critical issues ( SQ_VIOLATIONS_CRITICAL )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 100 ≤ 3 < 50 ≤ 4 < 10 ≤ 5

    The total number of issues (violations) found by SonarQube with a severity equal to CRITICAL.

  • Number of info issues ( SQ_VIOLATIONS_INFO )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 5000 ≤ 2 < 1000 ≤ 3 < 500 ≤ 4 < 100 ≤ 5

    The total number of issues (violations) found by SonarQube with a severity equal to INFO.

  • Number of major issues ( SQ_VIOLATIONS_MAJOR )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 100 ≤ 3 < 50 ≤ 4 < 10 ≤ 5

    The total number of issues (violations) found by SonarQube with a severity equal to MAJOR.

  • Number of minor issues ( SQ_VIOLATIONS_MINOR )

    Provided by: SonarQube45

    Used by:

    Scale: 1 < 500 ≤ 2 < 100 ≤ 3 < 50 ≤ 4 < 10 ≤ 5

    The total number of issues (violations) found by SonarQube with a severity equal to MINOR.


Page generated by Alambic 3.3.2 on Wed Oct 18 21:48:56 2017.