1. MonkeyProof Coding Standard for MATLAB
  2. Table of Contents
  3. Introduction
  4. 1. Naming conventions
    ❱
    1. 1.1. Loop iterator naming
    2. 1.2. Negated boolean names
    3. 1.3. Parent / child name redundancy
    4. 1.4. Name shadowing
    5. 1.5. Names to avoid
    6. 1.6. Function names document their use
    7. 1.7. Function name construction
    8. 1.8. Name-value pair casing
    9. 1.9. The 'Test' suffix
    10. 1.10. Name length
    11. 1.11. Descriptive names
    12. 1.12. The 'is' prefix
    13. 1.13. Abbreviations
    14. 1.14. Units in variable names
    15. 1.15. The 'n' prefix
    16. 1.16. Name class object
  5. 2. Layout & comments
    ❱
    1. 2.1. Comment blocks
    2. 2.2. Indentation guidelines
    3. 2.3. Whitespace guidelines
    4. 2.4. Line length
    5. 2.5. Comments on poorly written code
    6. 2.6. Equals sign alignment
    7. 2.7. Commas in rows
    8. 2.8. Methods/Properties blocks with duplicate attributes
    9. 2.9. Tab characters
    10. 2.10. Properties blocks before methods blocks
    11. 2.11. Help text
    12. 2.12. Correct spelling
    13. 2.13. Align struct definition
    14. 2.14. Constants with end of line comments
  6. 3. Statements & expressions
    ❱
    1. 3.1. Constant definitions at top
    2. 3.2. Magic numbers
    3. 3.3. Function calls without inputs
    4. 3.4. One statement per line
    5. 3.5. If else
    6. 3.6. Switch otherwise
    7. 3.7. Mixed types in expressions
    8. 3.8. Parentheses in logical expressions
    9. 3.9. Parentheses in mathematical expressions
    10. 3.10. Assert inputs
    11. 3.11. Global variables
    12. 3.12. Constant conditional statements
    13. 3.13. Group struct field definitions
    14. 3.14. Dependencies known
    15. 3.15. Try for exception handling
    16. 3.16. Floating-point comparisons
    17. 3.17. Zero before decimal point
    18. 3.18. Workspace variable ans
    19. 3.19. Debugging functions
    20. 3.20. Elseif else
    21. 3.21. Abstract class instantiation
    22. 3.22. Command syntax
    23. 3.23. Accessing other workspaces
    24. 3.24. Logical indexing
    25. 3.25. Loop vectorization
    26. 3.26. Use switch blocks
    27. 3.27. Variable in one unit
    28. 3.28. Undocumented functions
  7. 4. Higher level rules
    ❱
    1. 4.1. Complexity
    2. 4.2. Number of function arguments
    3. 4.3. Constructors with single output
    4. 4.4. Scripts
    5. 4.5. Editor warnings
    6. 4.6. Getters and setters
    7. 4.7. Mex-files
    8. 4.8. Nesting depth
    9. 4.9. Repeated code
    10. 4.10. Structure ownership
    11. 4.11. Single responsibility
    12. 4.12. Commented out code
    13. 4.13. Reuse of iterator variables
    14. 4.14. Rewriting existing functions
    15. 4.15. Columns with implicit meaning
    16. 4.16. Nested functions
    17. 4.17. Input parameter dependency
    18. 4.18. Missing methods declarations and implementations
    19. 4.19. Mismatch input and output declarations and implementations
    20. 4.20. First output constructor
    21. 4.21. Iterator variables outside loop
    22. 4.22. More input arguments than expected
    23. 4.23. Superclass property implementation
    24. 4.24. Java dependency
    25. 4.25. Method access permissions
  8. 5. Security
    ❱
    1. 5.1. Eval-functions
    2. 5.2. Shell escape
    3. 5.3. Security Security Server Certificate Usage
    4. 5.4. Security XML reading
    5. 5.5. Constant variable names
    6. 5.6. Security Username and Password
  9. 6. Release notes

MonkeyProof Coding Standard for MATLAB v1.4.0

Statements & expressions