Inspectopedia Help

Method naming convention

Reports methods whose names are too short, too long, or do not follow the specified regular expression pattern.

Instance methods that override library methods and constructors are ignored by this inspection.

Example: if the inspection is enabled for static methods, and the minimum specified method name length is 4 (the default), the following static method produces a warning, because the length of its name is 3, which is less than 4: public static int max(int a, int b).

A quick-fix that renames such methods is available only in the editor.

Configure the inspection:

Use the list in the Options section to specify which methods should be checked. Deselect the checkboxes for the method types for which you want to skip the check. Specify 0 in the length fields to skip the corresponding checks.

Regular expressions should be specified in the standard java.util.regex format.

Inspection options

Option

Type

Default

CheckboxPanel

None

Instance method

Checkbox

false

Pattern

String

[a-z][A-Za-z\d]*

Min length

Number

4

Max length

Number

32

'static' method

Checkbox

false

Pattern

String

[a-z][A-Za-z\d]*

Min length

Number

4

Max length

Number

32

'native' method

Checkbox

false

Pattern

String

[a-z][A-Za-z\d]*

Min length

Number

4

Max length

Number

32

JUnit 4+ test method

Checkbox

false

Pattern

String

[a-z][A-Za-z_\d]*

Min length

Number

4

Max length

Number

64

JUnit 3 test method

Checkbox

false

Pattern

String

test[A-Za-z_\d]*

Min length

Number

8

Max length

Number

64

TestNG test method

Checkbox

false

Pattern

String

[a-z][A-Za-z_\d]*

Min length

Number

4

Max length

Number

64

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023