Suspicious variable/parameter name combination
Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it.
Example 1:
Example 2:
Configure the inspection:
Use the Group of names area to specify the names which should not be used together: an error is reported if the parameter name or assignment target name contains words from one group and the name of the assigned or passed variable contains words from a different group.
Use the Ignore methods area to specify the methods that should not be checked but have a potentially suspicious name. For example, the Integer.compare()
parameters are named x
and y
but are unrelated to coordinates.
Inspection options
Option | Type | Default |
---|---|---|
Groups of names (comma-separated) | StringList | [x,width,left,right, y,height,top,bottom] |
Ignore methods | Table | None |
Class Name | TableColumn | [java.io.PrintStream, java.io.PrintWriter, java.lang.System, java.sql.PreparedStatement, java.sql.ResultSet, java.sql.SQLOutput, java.lang.Integer, java.lang.Long, java.lang.Short, java.lang.Byte, java.lang.Character, java.lang.Boolean, java.lang.Math, java.lang.StrictMath] |
Method Name Regex | TableColumn | [println, println, identityHashCode, set.*, update.*, write.*, compare.*, compare.*, compare, compare, compare, compare, .*, .*] |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |