CodeImprover Technical Reference

Metric Name:

Lines In Method

What:

CodeImprover counts all lines incl. blank lines and lines containing only comments. This is because this metric addresses the significant problem of overseeing an entire method on one screen without scrolling.

Default setting:

Any number of lines above 25 triggers negative Observations Score points.

Why:

Too long methods often mean that the responsibility of a method covers too much logic.

What to do:

Consider dividing the method into one or more private methods each of which is responsible for a subtask of the original method. This usually also aides testability. However, be aware that a short unreadable/complex method is worse than a longer readability method.


Context – How it works
Back to – Metrics reference overview