scitools.com

← Metric catalog

Removed Modules 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 Modules

API IDCountDeclModuleRemoved
TargetsArchitectures Files Functions Modules Project Subprograms
LanguagesFortran Jovial Pascal
CategoriesCompare Contents
CostCached

Number of removed modules, compared to the comparison database.

Counts modules defined in the comparison database but not in the current database. See Modules for what counts as a module. Since changes come from a textual diff, a module 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 modules as new or removed.

For example, diffing a file's current version against the comparison database's version:

--- modules.f90 (comparison database)
+++ modules.f90 (current)
@@ -1,28 +1,44 @@
 MODULE counters
   IMPLICIT NONE
   INTEGER :: total = 0
 END MODULE counters
 
-MODULE legacy_io
-  IMPLICIT NONE
-CONTAINS
-  SUBROUTINE print_value(x)
-    REAL, INTENT(IN) :: x
-    PRINT *, x
-  END SUBROUTINE print_value
-END MODULE legacy_io
-
 MODULE constants
   IMPLICIT NONE
-  REAL, PARAMETER :: pi = 3.14
+  REAL, PARAMETER :: pi = 3.14159
 END MODULE constants
 
 MODULE geometry
   USE constants
   IMPLICIT NONE
 CONTAINS
   REAL FUNCTION circle_area(r)
     REAL, INTENT(IN) :: r
     circle_area = pi * 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 geometry
+
+MODULE units
+  IMPLICIT NONE
+  REAL, PARAMETER :: cm_per_inch = 2.54
+END MODULE units
+
+MODULE reporting
+  USE, INTRINSIC :: iso_fortran_env, ONLY: output_unit
+  IMPLICIT NONE
+CONTAINS
+  SUBROUTINE report(x)
+    REAL, INTENT(IN) :: x
+    WRITE (output_unit, *) x
+  END SUBROUTINE report
+END MODULE reporting
+
+MODULE settings
+  IMPLICIT NONE
+  LOGICAL :: verbose = .FALSE.
+END MODULE settings

legacy_io was removed, so CountDeclModuleRemoved = 1.

See New Modules for the reverse of this metric, Changed Modules for modules in both versions that differ, and Modules 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 module changed.