# Maintainability Index

Maintainability Index: Do not write functions that have a very low maintainability index. This makes the code hard to maintain.

Bad code

    Any procedure / trigger that has a maintainability index < 20

Good code

    Any procedure / trigger that has a maintainability index >= 20\.
    The Maintainability Index is computed as a function:
        - Lines Of Code (inverse proportional)
        - the Halstead Volume
        - Cyclomatic Complexity (inverse proportional).

More info

- Halstead Volume
- Cyclomatic Complexity

Bad code

    Any procedure / trigger that is > 100 lines of code

Good code

    Any procedure / trigger that is <= 100 lines of code.
    A full C/AL Statement counts as 1 line of code

Last modified February 20, 2022: Restructure for Docsy theme (cceb0c94)