Function indentation cc4m_logo_inline

IDLAYOUT-2
TitleIndent function bodies on the root level of a file.
PriorityRecommended
Severity level10
DescriptionBodies of all functions (at any level) shall be indented. By default, only method bodies in a classdef file and nested functions are indented. This can be changed in the MATLAB preferences under Editor/Debugger / Language / Indenting by setting the Function indenting format to Indent all functions.
RationaleThis helps maintain the consistency with all other blocks in MATLAB.

Avoid:

function computeWeight(in)
weight = 2 * in;
end

Instead use:

function computeWeight(in)
    weight = 2 * in;
end