# Maintainability Index

##### Tags:

- C/AL

##### Categories:

- Best Practice

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 24, 2022: Added tags & categories + cleanup (5ee04366) by waldo1001