scitools.com

← Metric catalog

Useful Lines of Code (CBRI) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.

Useful Lines of Code (CBRI)

API ID: CBRIUsefulLOC
Languages: Any
Targets: Architectures, Files, Project

Lines of code excluding lines with only punctuation.

This metric is one of five file complexity metrics used by CBR-Insight, a program that grades project quality. (Ludwig, Jeremy, Devin Cline, and Aaron Novstrup. "A case study using CBR-insight to visualize source code quality." 2020 IEEE Aerospace Conference. IEEE, 2020.) . The five metrics and thresholds are:

This metric is used as Lines of Code (LOC), but differs from the built-in CountLineCode metric by excluding lines with only punctuation. So, the following code has a CountLineCode value of 10 but a CBRIUsefulLOC value of only 6 because of the four punctuation only lines.

    bool playPickleball(int windSpeed, int temp)
    {                                  // ignored
      if (temp < 60 || temp > 80) {
        return false;
      }                                // ignored

      if (windSpeed > 10) {
        return false;
      }                                // ignored

      return true;
    }                                  // ignored
    

See also the Project Quality solution.