scitools.com

← Metric catalog

Direct Dependency References In 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.

Direct Dependency References In

API ID: CountDirectDepRefsIn
Languages: Any
Targets: Architectures

Total number of dependency references from other architectures into this architecture's own entities only.

References into descendants are excluded.

In the sample below, for "project", only references into main.cpp count (api.cpp and ui.cpp are in child architectures). The 7 references from main_test.cpp to main.cpp give CountDirectDepRefsIn = 7; the 5 references from api_test.cpp to api.cpp do not count.

Compare to CountDepRefsIn (all references into this subtree) and CountDirectDepsIn (number of dependent architectures).

Consider a directory-style architecture and dependencies:

Dependencies (with reference counts):

  1. main.cpp → api.cpp (3 refs)
  2. main.cpp → ui.cpp (9 refs)
  3. main.cpp → library1.cpp (8 refs)
  4. api.cpp → library1.cpp (6 refs)
  5. ui.cpp → library2.cpp (4 refs)
  6. ui.cpp → api.cpp (2 refs)
  7. main_test.cpp → main.cpp (7 refs)
  8. api_test.cpp → api.cpp (5 refs)

For project, the metrics are:

MetricValue
CountDepsIn2
CountDepsOut2
CountDepRefsIn12
CountDepRefsOut18
CountDirectDepsIn1
CountDirectDepsOut3
CountDirectDepRefsIn7
CountDirectDepRefsOut20
CountMajorDepsIn1
CountMajorDepsOut1