Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[all] Maintainability index for files and folders #3513

Open
rupam925 opened this issue Sep 20, 2021 · 3 comments
Open

[all] Maintainability index for files and folders #3513

rupam925 opened this issue Sep 20, 2021 · 3 comments
Labels
an:enhancement An improvement on existing features / rules

Comments

@rupam925
Copy link

PMD analyzer should give the maintainability index for the files and folders. It should give metrics for how much the code is maintainable.

@rupam925 rupam925 added the a:new-rule Proposal to add a new built-in rule label Sep 20, 2021
@adangel adangel added an:enhancement An improvement on existing features / rules and removed a:new-rule Proposal to add a new built-in rule labels Sep 24, 2021
@adangel
Copy link
Member

adangel commented Sep 24, 2021

Thanks for your suggestion.
Can you elaborate a bit, what this maintainability index is and how this could be determined?

@rupam925
Copy link
Author

Maintainability Index is a software metric which measures how maintainable (easy to support and change) the source code is. The maintainability index is calculated as a factored formula consisting of Lines Of Code, Cyclomatic Complexity and Halstead volume. It is used in several automated software metric tools, including the Microsoft Visual Studio 2010 development environment, which uses a shifted scale (0 to 100) derivative.
First we need to measure the following metrics from the source code:
V = Halstead Volume
G = Cyclomatic Complexity
LOC = count of source Lines Of Code (SLOC)
CM = percent of lines of Comment (optional)
From these measurements the MI can be calculated:
The original formula:
MI = 171 - 5.2 * ln(V) - 0.23 * (G) - 16.2 * ln(LOC)
The derivative used by SEI is calculated as follows:
MI = 171 - 5.2 * log2(V) - 0.23 * G - 16.2 * log2 (LOC) + 50 * sin (sqrt(2.4 * CM))

@linusjf
Copy link

linusjf commented Sep 30, 2021

Quality scores have also been discussed elsewhere. Linking in... #2942

@adangel adangel changed the title Maintainability index for files and folders [all] Maintainability index for files and folders Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
an:enhancement An improvement on existing features / rules
Projects
None yet
Development

No branches or pull requests

3 participants