ExcessivePublicCount - lpohl-Reply/pmd-github-action GitHub Wiki

Rule: ExcessivePublicCount

Message

The class {0} has {1} public methods, attributes, and properties (limit: {2})

Description

Classes with large numbers of public methods, attributes, and properties require disproportionate testing efforts since combinatorial side effects grow rapidly and increase risk. Refactoring these classes into smaller ones not only increases testability and reliability but also allows new variations to be developed easily.

Priority

5 (was 3)

Example

public class Foo {
    public String value;
    public Bar something;
    public Variable var;
    // [... more more public attributes ...]

    public void doWork() {}
    public void doMoreWork() {}
    public void doWorkAgain() {}
    // [... more more public methods ...]

    public String property1 { get; set; }
    // [... more more public properties ...]
}