Skip to content

structure/trivial-functions

Finds functions with too few statements and files that only forward to other code.

Part of the structure configuration, at the all level. It runs at the commit stage, once per scope. gspot runs this check itself.

A function of one statement makes the reader jump for nothing.

Inline a forwarding function at its calls and delete it. Split independent statements into the files that use them.

A Bash function that only calls another reports a finding. Inline the call at each caller, and delete the wrapper.

Turn it off for some files, with a reason:

gspot ignore structure/trivial-functions --paths "<glob>" --reason "<why>"