Metric-StabilityIndex

Measures the stability of components based on their fan-in and fan-out values

Required inputs: RFG

Stability Index

Measures the ratio of fan-in to the sum of fan-in and fan-out for the chosen node_types_to_consider in a lifted view of hierarchy_view_name with base_view_name.

Only edges of types listed in edge_types_to_consider are used as "dependencies" for the calculation.

Formula

Stability Index = Fan-In / (Fan-In + Fan-Out) = 1 - Fan-Out / (Fan-In + Fan-Out)

Interpretation

  • 1.0 - Node has only incoming dependencies (fan-in). Maximally stable.
  • 0.0 - Node has only outgoing dependencies (fan-out). Maximally volatile.

This metric helps identify components that are more stable (higher index) versus those that are more volatile (lower index) in terms of their dependencies.

Possible Messages

This rule has no predefined messages.

Options

display_name

display_name : str | None = None

Description of the metric shown in the dashboard. If None, rfg_metric_name is used.
 

edge_types_to_consider

edge_types_to_consider : set[str] = {'Static_Call'}

Set of edge types (from base_view_name) to consider as dependencies for the stability calculation.
 

max_value

max_value : float | None = None

Maximum allowed value. None if unlimited.
 

min_value

min_value : float | None = None

Minimum allowed value. None if unlimited.
 

node_types_to_consider

node_types_to_consider : set[str] = {'Module'}

Set of node types (from hierarchy_view_name) to calculate the stability index for. Please note that node types that are hierarchically nested are not supported in node_types_to_consider.
 

rfg_metric_name

rfg_metric_name : str = 'Metric.StabilityIndex'

Name of the node attribute storing the metric value in the RFG.