scitools.com

← Metric catalog

Changed 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.

Changed Modules

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

Number of changed modules, compared to the comparison database.

Counts modules defined in both databases whose text differs. A module counts once, however many of its lines changed. 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

constants has a changed value and geometry has a new function, so CountDeclModuleChanged = 2. counters is the same in both versions, so it doesn't count.

See New Modules and Removed Modules for modules that exist in only one version, 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.