.. index:: single: mi_metric(Stroud)
.. _mi_metric/1:

.. rst-class:: right

**object**

``mi_metric(Stroud)``
=====================

* ``Stroud`` - Halstead metric coefficient for computing the time required to program.


Computes the maintainability index metric based on the Cyclomatic Complexity, Halstead Volume, and lines of code metrics for an entity.

| **Availability:** 
|    ``logtalk_load(code_metrics(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-03-14

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`code_metrics_utilities <code_metrics_utilities/0>`
|    ``public`` :ref:`code_metric <code_metric/0>`
| **Uses:**
|    :ref:`cc_metric <cc_metric/0>`
|    :ref:`halstead_metric(Stroud) <halstead_metric/1>`
|    :ref:`lines_metric <lines_metric/0>`

| **Remarks:**

   - Formula: The original equation is used: ``MI = 171 - 5.2 * ln(V) - 0.23 * C - 16.2 * ln(L)``. V is the Halstead volume, C is the Cyclomatic Complexity, and L is the number of code lines.
   - Entity score: Represented as the compound term ``mi(MI)``.

| **Inherited public predicates:**
|     :ref:`code_metric/0::all/0`  :ref:`code_metric/0::all/1`  :ref:`code_metric/0::all_score/1`  :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`code_metric/0::directory/1`  :ref:`code_metric/0::directory/2`  :ref:`code_metric/0::directory_score/2`  :ref:`code_metric/0::entity/1`  :ref:`code_metric/0::entity_score/2`  :ref:`code_metric/0::file/1`  :ref:`code_metric/0::file/2`  :ref:`code_metric/0::file_score/2`  :ref:`code_metric/0::format_entity_score//2`  :ref:`code_metric/0::library/1`  :ref:`code_metric/0::library/2`  :ref:`code_metric/0::library_score/2`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`code_metric/0::rdirectory/1`  :ref:`code_metric/0::rdirectory/2`  :ref:`code_metric/0::rdirectory_score/2`  :ref:`code_metric/0::rlibrary/1`  :ref:`code_metric/0::rlibrary/2`  :ref:`code_metric/0::rlibrary_score/2`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

(no local declarations; see entity ancestors if any)

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

