Inspectopedia Help

Class naming convention

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

Example: if the inspection is enabled for tests, and the specified length for the minimum class name is 8 (the default), the following test class produces a warning because the length of its name is 6, which is less than 8: public class MyTest{}.

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

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

NewClassNamingConvention
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Naming conventions | Class

Configure the inspection:

Use the list in the Options section to specify which classes should be checked. Deselect the checkboxes for the classes for which you want to skip the check.

For each class type, specify the minimum length, maximum length, and the regular expression expected for class names using the provided input fields. Specify 0 in the length fields to skip corresponding checks.

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

Inspection options

Here you can find the description of settings available for the Class naming convention inspection, and the reference of their default values.

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Java, 241.18072

Last modified: 18 June 2024