Removed Executable 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 Executable Units
| API ID | CountDeclExecutableUnitRemoved |
| Targets | Architectures Files Project |
| Languages | Ada Basic C# Fortran Java Pascal Python Web |
| Categories | Compare Contents |
| Cost | Cached |
Number of removed executable units, compared to the comparison database.
Counts executable units defined in the comparison database but not in the current database. See Executable Units for what counts as an executable unit. Since changes come from a textual diff, an executable 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 executable units as new or removed.
For example, diffing a file's current version against the comparison database's version:
--- executableunits.java (comparison database)
+++ executableunits.java (current)
@@ -1,23 +1,41 @@
abstract class Shape {
abstract double area();
+ abstract double scale(double factor);
+
String describe() {
- return "shape";
+ return "a shape with area " + area();
}
}
class Circle extends Shape {
double r = 1;
- double perimeter() {
- return 2 * 3.14 * r;
- }
-
String name() {
return "circle";
}
+ Circle(double r) {
+ this.r = r;
+ }
+
double area() {
- return 3.14 * r * r;
+ return 3.14159 * r * r;
+ }
+
+ double scale(double factor) {
+ return area() * factor * factor;
}
}
+
+class Square extends Shape {
+ double side = 1;
+
+ double area() {
+ return side * side;
+ }
+
+ double scale(double factor) {
+ return area() * factor * factor;
+ }
+}
Circle.perimeter() was removed, so CountDeclExecutableUnitRemoved = 1.
In Web, a file with top-level code also counts as an executable unit. It's new or removed when that code appears or disappears, and otherwise it has the status of the whole file, so any change to the file counts it as changed.
See New Executable Units for the reverse of this metric, Changed Executable Units for executable units in both versions that differ, and Executable 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 an executable unit changed.