MainSequenceAnalyzer
Computes each module's position relative to Robert Martin's main sequence - the line A + I = 1.
Instability (I) =
Ce / (Ca + Ce), taken from the dependency graph (production edges only).Abstractness (A) =
Na / (Na + Nc), the ratio of abstract to total type declarations, supplied by a coarse source scan (the graph alone cannot know it).Distance (D) =
|A + I - 1|, how far the module sits from the ideal balance.0is on the line;1is a far corner.
A concrete-and-stable module (low A, low I) is in the zone of pain - rigid and hard to change yet widely depended upon. An abstract-and-unstable module (high A, high I) is in the zone of uselessness - abstractions almost nothing uses. This is a pure function; the scan that produces TypeAbstractness lives in the Gradle module.
Types
Functions
Builds the MainSequenceReport for graph given per-module type counts. Modules with no counted types (missing from abstractness or with zero total) are skipped - abstractness is undefined for them. Results are sorted worst-distance first.
Counts abstract vs concrete type declarations in one file's source text with a deliberately coarse lexical scan - it strips comments and matches declaration keywords, not a full parse. An interface is abstract; a class is abstract when abstract or sealed; everything else (concrete/data/enum/value classes, objects, Java enums) is concrete. Pure, so the regex edge cases are unit-tested here rather than through file I/O.