Removed Program Units 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.
Removed Program Units
| API ID | CountDeclProgUnitRemoved |
| Targets | Architectures Files Project |
| Languages | Fortran |
| Categories | Compare Contents |
| Cost | Cached |
Number of removed program units, compared to the comparison database.
Counts program units defined in the comparison database but not in the current database. See Program Units for what counts as a program unit. Since changes come from a textual diff, a program unit must have Lines to count. For an architecture or the project, the counts from its files are added together. A file added to or removed from an architecture counts all of its program units as new or removed.
For example, diffing a file's current version against the comparison database's version:
--- progunits.f90 (comparison database)
+++ progunits.f90 (current)
@@ -1,29 +1,46 @@
MODULE shapes
IMPLICIT NONE
CONTAINS
REAL FUNCTION circle_area(r)
REAL, INTENT(IN) :: r
- circle_area = 3.14 * r * r
+ circle_area = 3.14159 * r * r
END FUNCTION circle_area
+
+ REAL FUNCTION square_area(side)
+ REAL, INTENT(IN) :: side
+ square_area = side * side
+ END FUNCTION square_area
END MODULE shapes
SUBROUTINE log_value(x)
REAL, INTENT(IN) :: x
PRINT *, x
END SUBROUTINE log_value
-SUBROUTINE old_report(x)
- REAL, INTENT(IN) :: x
- PRINT *, 'value:', x
-END SUBROUTINE old_report
-
REAL FUNCTION double_it(x)
REAL, INTENT(IN) :: x
double_it = 2 * x
END FUNCTION double_it
+REAL FUNCTION triple_it(x)
+ REAL, INTENT(IN) :: x
+ triple_it = 3 * x
+END FUNCTION triple_it
+
+SUBROUTINE new_report(x)
+ REAL, INTENT(IN) :: x
+ PRINT *, 'new value:', x
+END SUBROUTINE new_report
+
+BLOCK DATA init_data
+ LOGICAL :: verbose
+ COMMON /settings/ verbose
+ DATA verbose /.FALSE./
+END BLOCK DATA init_data
+
PROGRAM main
USE shapes
IMPLICIT NONE
CALL log_value(circle_area(1.0))
+ CALL new_report(square_area(2.0))
END PROGRAM main
The subroutine old_report was removed, so CountDeclProgUnitRemoved = 1.
See New Program Units for the reverse of this metric, Changed Program Units for program units in both versions that differ, and Program Units for the total count. See Compare two versions of a project ↗ for how entities are compared, and New Lines, Removed Lines, and Changed Lines for how much a program unit changed.