Skip to content

builtin.size.fn-length

FieldValue
idbuiltin.size.fn-length
severitywarn
categorysize
scopefile
languagesrust, python, go, java, typescript, tsx, javascript
evaluatorbuiltin / fn_length

Long functions tend to bundle multiple responsibilities, hide branching complexity, and resist isolated testing. A function that doesn’t fit on a screen is a function that’s hard to reason about.

Configure under [size] in .sextant/config.toml:

[size]
fn_length_warn = 60
fn_length_error = 120
SettingDefaultEffect
fn_length_warn60Functions at or above this trigger a warn.
fn_length_error120Functions at or above this escalate to error.

The line count is from the function’s opening brace (or its def line in Python) through the closing brace. Blanks and comments inside the body count.

  • Look for natural seams: a leading “set up” block, a middle “decide” block, a trailing “render/persist” block. Each is usually a candidate helper.
  • Push branches into early returns; pull error mapping into a single tail expression.
  • If a function manages too much state, consider promoting that state into a struct with methods.