Code Lines 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.
Code Lines
API ID: CountLineCodeAlso Known As: Lines of Code (LOC), Source Lines of Code (SLOC)
Languages: Ada, Assembly, Basic, C#, C++, Fortran, Java, Jovial, Pascal, Python, Rust, VHDL, Web
Targets: Architectures, Classes, Files, Functions, Modules, Packages, Project, Subprograms
Number of lines containing source code.
Note that a line can contain source and a comment and thus count towards multiple metrics. For classes this is the sum of CountLineCode for the member functions of the class.
Also known as Lines of Code (LOC); Source Lines of Code (SLOC).
- Ada: Project, File, Type, Entry, Function, Package, Procedure, Protected, Task
- Basic: Project, File, Method, Module, Class
- C#: Project, File, Class, Method
- C++: Project, File, Class, Struct, Union, Function
- Fortran: Project, File, Module, Block Data, Function, Program, Subroutine
- Java: Project, File, Class, Interface, Method
- Jovial: Project, File, Module, Subroutine
- Pascal: Project, File, Class, Interface, Compunit, Function, Procedure
- Python: Project, File, Class, Function
- Rust: Project, File, Function
- VHDL: Project, File, Procedure, Function, Process, Architecture
- Web: Project, File, PHP Class, PHP Interface
- This metric can be disabled from "Project Configuration/Metrics/Lines and Statements" with the "Show line count metrics" option.
- This metric can be disabled from "Project Configuration/Metrics/Lines and Statements" with the "Include inactive lines" option for languages that have inactive lines.
- For projects and architectures, this metric is enabled from "Project Configuration/Metrics/Projects and Architectures" with the "Show default summary metrics" option.