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.
What to do
Section titled “What to do”Inline a forwarding function at its calls and delete it. Split independent statements into the files that use them.
Example
Section titled “Example”A Bash function that only calls another reports a finding. Inline the call at each caller, and delete the wrapper.
Turn it off
Section titled “Turn it off”Turn it off for some files, with a reason:
gspot ignore structure/trivial-functions --paths "<glob>" --reason "<why>"