checkFunctionIndented

Used to check whether or not functions are indented. Rules may specify that the contents of every function must be indented or that they should not be. The following rules apply to this check:

  • A line of code is considered indented if it has at least IndentationLength whitespace characters at the start, with IndentationLength a parameter value.

  • Comments are ignored during this check.

  • A function block is only considered indented if all of its code is indented.

  • A function block is considered non-indented if at least one line of code has zero indentation.

Configurable parameters

  • DoIndent (boolean): Set to 1 to require a function block to be indented. Set to false if function blocks should not be indented.

  • IgnoreTabs (boolean): Set to 1 to ignore violations related to tabs, the check does not result in unnecessary violations when using another computer with a different MATLAB preference 'EditorSpacesPerTab'. The default value for this parameter is false.

  • IndentationLength (double): The minimum indentation length. If a function block must be indented, code must at least be indented by this amount of whitespace characters. Note: this value is ignored when DoIndent is set to 0, because in that case, the code should not be indented at all. The value must lie between 1 and 8.

Exemption tag: %@ok<CFIND>