Table of Contents
MonkeyProof Coding Standard for MATLAB
-
- Loop iterator naming
- Negated boolean names
- Parent / child name redundancy
- Name shadowing
- Names to avoid
- Function names document their use
- Function name construction
- Name-value pair casing
- The 'Test' suffix
- Name length
- Descriptive names
- The 'is' prefix
- Abbreviations
- Units in variable names
- The 'n' prefix
- Name class object
-
- Comment blocks
- Indentation guidelines
- Whitespace guidelines
- Line length
- Comments on poorly written code
- Equals sign alignment
- Commas in rows
- Methods/Properties blocks with duplicate attributes
- Tab characters
- Properties blocks before methods blocks
- Help text
- Correct spelling
- Align struct definition
- Constants with end of line comments
-
- Constant definitions at top
- Magic numbers
- Function calls without inputs
- One statement per line
- If else
- Switch otherwise
- Mixed types in expressions
- Parentheses in logical expressions
- Parentheses in mathematical expressions
- Assert inputs
- Global variables
- Constant conditional statements
- Group struct field definitions
- Dependencies known
- Try for exception handling
- Floating-point comparisons
- Zero before decimal point
- Workspace variable ans
- Debugging functions
- Elseif else
- Abstract class instantiation
- Command syntax
- Accessing other workspaces
- Logical indexing
- Loop vectorization
- Use switch blocks
- Variable in one unit
- Undocumented functions
-
- Complexity
- Number of function arguments
- Constructors with single output
- Scripts
- Editor warnings
- Getters and setters
- Mex-files
- Nesting depth
- Repeated code
- Structure ownership
- Single responsibility
- Commented out code
- Reuse of iterator variables
- Rewriting existing functions
- Columns with implicit meaning
- Nested functions
- Input parameter dependency
- Missing methods declarations and implementations
- Mismatch input and output declarations and implementations
- First output constructor
- Iterator variables outside loop
- More input arguments than expected
- Superclass property implementation
- Java dependency
- Method access permissions