Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mehen.ophi.dev/llms.txt

Use this file to discover all available pages before exploring further.

NEXITS counts the number of exit points each function/method has. The classic structured-programming recommendation is one exit per function — a high NEXITS suggests the function ought to be split.

What mehen emits

KeyTypeDescription
nexitintTotal exit points across functions in the space.
nexit.averagefloatMean exit-point count per function.
nexit.minintMinimum across functions.
nexit.maxintMaximum across functions.
nexit.sumintSum across child spaces.

What counts as an exit

Each language analyzer maps its language’s exit-flow constructs:
  • return and value-returning expressions.
  • throw / raise / panic! statements.
  • yield / yield return (generator functions).
  • exit, os.exit, and the equivalent process-exit calls where unambiguous.
  • Labeled break that exits the function (rare in practice).
The count is per-function: the parser walks each function body and adds 1 per matching node.

How to read it

nexitInterpretation
1Single exit point — classic structured style.
2–4Pragmatic — early returns for guard clauses are a popular style.
5+Function does multiple things — extract methods.
Modern Rust, TypeScript, and Kotlin codebases tend to use early returns liberally. A NEXITS of 3–4 is not, by itself, a problem. Read NEXITS alongside Cognitive complexity — if both are high, the function is likely a refactor candidate.

References

  • Dijkstra, E. W. (1968). Go To Statement Considered Harmful. Communications of the ACM, 11(3).
  • Sonar: Metrics definitions.

See also