Classes should not have too many methods

Description

A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.

Message

Class "XXXX" has {0} [public] methods, which is greater than the {1} authorized. Split it into smaller classes.

Highlighting

None

List of parameters

  • Key: maximumMethodThreshold

    • Description: The maximum number of methods authorized in a class.

    • Default Value: 35

  • Key: countNonpublicMethods

    • Description: Whether or not to include non-public methods in the count

    • Default Value: true

0% Done
Loading...

Activity

Show:

Ann Campbell November 19, 2015 at 4:12 PM

: overrides yes, inherited methods, no.

Evgeny Mandrikov November 19, 2015 at 4:02 PM

I guess that count doesn't include inherited methods. Do you confirm?

Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Labels

Default Severity

Major

Targeted languages

ABAP
C#
JavaScript
Python
RPG
Swift
VB.Net
VB6

Covered Languages

C
C++
Flex
Java
Objective-C
PHP

Irrelevant for Languages

C
CSS
HTML
XML

Remediation Function

Constant/Issue

Constant Cost

Analysis Scope

Main Sources

Sentry

Created October 31, 2013 at 3:52 PM
Updated March 22, 2021 at 4:47 PM