Qodana 2022.2 Help

Inspections. What is new in 2022.2?

This page provides the list of changes in Qodana inspections as of version 2022.2.

Qodana for JVM and Qodana Community for JVM

New inspections

Inspection name

Severity

Description

RegExpRedundantClassElement

Weak warning

Redundant \d, [:digit:], or \D class elements.

The [\w+\d] regular expression can be replaced with [\w+] because \w already includes \d.

MarkdownIncorrectlyNumberedListItem

Warning

Incorrectly numbered list item.

Marks an ordered list like 1. 2. 4. as inconsistently numbered. After rendering, this list is displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

This table contains the list of new Kotlin inspections.

Inspection name

Severity

Description

NoConstructorMigration

Disabled; error

Forbidden constructor call

PatternVariableHidesField

Warning

-

AddConversionCallMigration

Disabled; warning

Explicit conversion from Int required starting from version 1.9 of Kotlin

AmbiguousExpressionInWhenBranchMigration

Disabled; warning

Ambiguous logical expressions in when branches starting from version 1.7 of Kotlin

CastDueToProgressionResolutionChangeMigration

Disabled; warning

Progression resolution change starting from version 1.9 of Kotlin

InlineClassDeprecatedMigration

Disabled; warning

Inline classes are deprecated starting from version 1.5 of Kotlin

OverrideDeprecatedMigration

Disabled; error

Do not propagate method deprecation through overrides since 1.9

Below is the list of inspections related to the code style and DevKit.

Inspection name

Severity

Description

KotlinJvmAnnotationInJava

Warning

Kotlin JVM annotation in Java

KotlinRedundantDiagnosticSuppress

Warning

Redundant diagnostic suppression

NonStrictComparisonCanBeEquality

Weak warning

Non-strict inequality >= or <= that can be replaced with ==

ReassignedVariable

Text attributes

The variable was previously reassigned

VerboseNullabilityAndEmptiness

Weak warning

Check verbose nullability and emptiness.

WorkspaceImplAbsent

Warning

Absent entity implementation

WorkspaceImplObsolete

Warning

Obsolete version of entity implementation

Refactored inspections

In 2022.2, several Kotlin and JUnit inspections were refactored.

Inspection name

Severity

Description

OverridingDeprecatedMember

Disabled; error

Was renamed for OverrideDeprecatedMigration

MainFunctionReturnUnitInspection

-

Check for the @Test annotated methods was moved to JUnitMalformedeclaration

JUnitMalformedDeclaration

Warning

Works only for Kotlin.

Reports JUnit test member declarations that are malformed and not recognized by the JUnit test framework. Such declarations could result in non-executed tests or lifecycle methods.

Several of the old inspections were disabled by default. Starting from 2022.2, they are enabled by default, and there is no way to disable them individually.

Inspection name

Description

TestMethodIsPublicVoidNoArg

Marks test methods that are annotated with @Test but do not have the required signature.

StaticSuite

The suite() method is not declared as static

BeforeClassOrAfterClassIsPublicStaticVoidNoArg

Malformed @BeforeClass, @BeforeAll, @AfterClass, or @AfterAll method. Prior to 2022.2, this inspection was disabled.

BeforeOrAfterIsPublicVoidNoArg

Malformed @Before or @After method. Prior to 2022.2, this inspection was disabled.

JUnit5MalformedExtensions

JUnit 5 malformed extension registration

JUnit5MalformedNestedClass

JUnit 5 malformed @Nested class

Junit5MalformedParameterized

Malformed parameterized tests. Prior to 2022.2, this inspection was disabled.

JUnit5MalformedRepeated

JUnit 5 malformed repeated test

JUnitDatapoint

Malformed @DataPoint field. Prior to 2022.2, this inspection was disabled.

JUnitRule

Malformed @Rule or @ClassRule field. Prior to 2022.2, this inspection was disabled.

MalformedSetUpTearDown

Malformed setUp() or tearDown() method. Prior to 2022.2, this inspection was disabled.

UnconstructableTestCase

Reports JUnit test cases that cannot be constructed because they have an invalid constructor. Test cases like these will not be picked up by the JUnit test runner and will therefore not execute. The inspection severity is Warning.

Enabled inspections

Inspection name

Severity

Description

RegExpSimplifiable

Warning

A regular expression like [\wa-z\d] can be simplified to just \w because it already includes a-z as well as numerals.

RegExpSuspiciousBackref

Weak warning

A regular expression like \1(abc) cannot match anything because \1 refers to abc that is not yet defined when evaluating \1. This inspection prevents simple typos in regular expressions, speeding up the editing experience.

BulkFileAttributesRead

Disabled; warning

The 'Files.readAttributes' bulk call can be used instead of multiple file attribute calls

SlowListContainsAll

Warning

Call to list.containsAll may have poor performance

IllegalDependencyOnInternalPackage

Disabled; error

Illegal dependency on internal package

KotlinPlaceholderCountMatchesArgumentCount

Warning

Number of placeholders does not match number of arguments in logging call

NonExhaustiveWhenStatementMigration

Disabled; warning

Non-exhaustive when statements will be prohibited starting from version 1.7

RedundantScheduledForRemovalAnnotation

Warning

Redundant @ScheduledForRemoval annotation

ReplaceOnLiteralHasNoEffect

Warning

Replacement operation has no effect

Qodana for PHP

New inspections

In version 2022.2, the Qodana for PHP linter obtained several new inspections.

Inspection name

Severity

Description

RegExpRedundantClassElement

Weak warning

Redundant \d, [:digit:], or \D class elements

MarkdownIncorrectlyNumberedListItem

Warning

Incorrectly numbered list item.

Marks an ordered list like 1. 2. 4. as inconsistently numbered. After rendering, this list is displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

PhpIntRangesMismatchInspection

Warning

Number range mismatch.

Marks return statements containing numerals outside the range, for example, in returns int<0,10>. Also works for fields, field constructors, and function calls.

PhpVarTagWithoutVariableNameInspection

Weak warning

Type tag without a variable name.

The @param string PHPDoc snippet is redundant, and it should be either removed or replaced with @param string $argument explaining that the argument is a string.

PhpLoopCanBeReplacedWithStdFunctionCallsInspection

Weak warning

A typical loop consisting of three lines can be replaced with the in_array() or array_key_exists().

PhpPregSplitWithoutRegExpInspection

Weak warning

The preg_split() function can be replaced with explode() function.

PhpCombineMultipleIssetCallsIntoOneInspection

Informational

Multiple isset calls like isset($var1) && isset($var2) can be replaced with a single call like isset($var1, $var2).

PhpArrayTraversableCanBeReplacedWithIterableInspection

Weak warning

The array|Traversable type hint can be replaced with iterable

PhpEchoOpenTagInspection

Informational

The verbose <?php echo can be replaced with <?=.

PhpAccessStaticViaInstanceInspection

Weak warning

A class static member is accessed via an instance.

Similar to Java, a class static member should not be accessed via an instance expression because that would mean that it might be different for each instance.

PhpMockeryInvalidMockingMethodInspection

Error

Invalid Mockery mocking target

In Mockery tests, methods cannot be private. If protected, they must be specifically enabled using shouldAllowMockingProtectedMethods.

BladeUnpairedParenthesesInStringLiteral

Error

Parse error due to unpaired parentheses in string literals.

Early detection of unpaired parentheses in string literals that are later parsed by the Blade template engine.

Enabled inspections

Inspection name

Severity

Description

RegExpSimplifiable

Warning

Regular expression can be simplified.

A regular expression like [\wa-z\d] can be replaced with \w because the latter already includes a-z, as well as numerals.

RegExpSuspiciousBackref

Weak warning

Suspicious back reference.

A regular expression like \1(abc) cannot match anything because \1 refers to abc that is not yet defined when evaluating \1. This inspection prevents simple typos in regular expressions, speeding up the editing experience.

Qodana for JS

New inspections

Inspection name

Severity

Description

RegExpRedundantClassElement

Weak warning

The [\w+\d] regular expression can be replaced with [\w+] because \w already includes \d.

MarkdownIncorrectlyNumberedListItem

Warning

Marks an ordered list like 1. 2. 4. as inconsistently numbered. After rendering, this list is displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

Enabled inspections

Here is the list of inspections that were disabled prior to 2022.2.

Inspection name

Severity

Description

RegExpSimplifiable

Warning

A regular expression like [\wa-z\d] can be simplified to just \w because it already includes a-z as well as numerals.

RegExpSuspiciousBackref

Weak warning

A regular expression like \1(abc) cannot match anything because \1 refers to abc that is not yet defined when evaluating \1. This inspection prevents simple typos in regular expressions, speeding up the editing experience.

Besides new and enabled inspections in 2022.2, the MeteorUnresolvedSymbol was removed because the Meteor plugin became unbundled.

Qodana for Python

New inspections

Inspection name

Severity

Description

RegExpRedundantClassElement

Weak warning

Redundant \d, [:digit:], or \D class elements.

The [\w+\d] regular expression can be replaced with [\w+] because \w already includes \d.

MarkdownIncorrectlyNumberedListItem

Warning

Marks an ordered list like 1. 2. 4. as inconsistently numbered. After rendering, this list is displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

PyClassVarInspection

Warning

Invalid usage of ClassVar variables.

Reports invalid usages of variables annotated as ClassVar. For example, this can be assignment to ClassVar via instance, or annotating local variables with ClassVar.

Enabled inspections

Inspection name

Severity

Description

RegExpSimplifiable

Warning

A regular expression like [\wa-z\d] can be simplified to just \w because it already includes a-z as well as numerals.

RegExpSuspiciousBackref

Weak warning

A regular expression like \1(abc) cannot match anything because \1 refers to abc that is not yet defined when evaluating \1. This inspection prevents simple typos in regular expressions, speeding up the editing experience.

The JupyterKernelInspection inspection was removed from 2022.2 because it became almost unused.

Qodana Community for Android

New inspections

This table contains the list of general inspections that were introduced in 2022.2.

Inspection name

Severity

Description

RegExpRedundantClassElement

Weak warning

Redundant \d, [:digit:], or \D class elements.

The [\w+\d] regular expression can be replaced with [\w+] because \w already includes \d.

MarkdownIncorrectlyNumberedListItem

Warning

Incorrectly numbered list item.

Marks an ordered list like 1. 2. 4. as inconsistently numbered. After rendering, this list is displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

The table below contains the list of Kotlin inspections that became available starting from 2022.2

Inspection name

Severity

Description

NoConstructorMigration

Disabled; error

Forbidden constructor call

PatternVariableHidesField

Warning

Pattern variable hides field

AddConversionCallMigration

Disabled; warning

Starting from version 1.9 of Kotlin, explicit conversion from Int is required

AmbiguousExpressionInWhenBranchMigration

Disabled; warning

Ambiguous logical expressions starting from version 1.7 of Kotlin

CastDueToProgressionResolutionChangeMigration

Disabled; warning

Progression resolution change as of version 1.9 of Kotlin

InlineClassDeprecatedMigration

Disabled; warning

Inline classes are deprecated since version 1.5 of Kotlin

OverrideDeprecatedMigration

Disabled; error

No propagation of method deprecation through overrides as of version 1.9 of Kotlin

This table contains inspections related to code style.

Inspection name

Severity

Description

KotlinJvmAnnotationInJava

Warning

Kotlin JVM annotation in Java

KotlinRedundantDiagnosticSuppress

Warning

Redundant diagnostic suppression

NonStrictComparisonCanBeEquality

Weak warning

Non-strict inequality =< or <= can be replaced with ==

ReassignedVariable

Text attributes

Reassigned variable

VerboseNullabilityAndEmptiness

Weak warning

Check verbose nullability and emptiness.

This table lists inspections related to DevKit.

Inspection name

Severity

Description

WorkspaceImplAbsent

Warning

Absent entity implementation

WorkspaceImplObsolete

Warning

Obsolete version of entity implementation

AndroidLintAppBundleLocaleChanges

Warning

App Bundle handling of runtime locale changes

AndroidLintAssertionSideEffect

Warning

Assertions with Side Effects

AndroidLintBidiSpoofing

Error

Bidirectional text spoofing

AndroidLintDataExtractionRules

Warning

Missing data extraction rules

AndroidLintDiscouragedApi

Warning

Using discouraged APIs

AndroidLintFileEndsWithExt

Warning

-

AndroidLintIntentFilterUniqueDataAttributes

Warning

Data tags should only declare unique attributes

AndroidLintMotionLayoutMissingId

Error

Views inside MotionLayout require an id

AndroidLintNotConstructor

Warning

Not a constructor warning

AndroidLintRedundantLabel

Warning

Redundant label on activity

AndroidLintUastImplementation

Warning

Avoid using UAST implementation

AndroidLintViewBindingType

Error

Issues related to tools:viewBindingType

AndroidLintWearableConfigurationAction

Warning

-

AndroidLintWebViewClientOnReceivedSslError

Warning

Proceed with the HTTPS connection despite SSL errors

Refactored inspections

Inspection name

Severity

Description

OverridingDeprecatedMember

Disabled; error

Was renamed for OverrideDeprecatedMigration

MainFunctionReturnUnitInspection

-

The @Test method checking functionality was moved to JUnitMalformedeclaration

JUnitMalformedDeclaration

Warning

Works only for Kotlin.

Reports JUnit test member declarations that are malformed and not recognized by the JUnit test framework. Such declarations could result in non-executed tests or lifecycle methods.

Several inspections were disabled by default. Starting from 2022.2, they are enabled, and there is no way to disable them individually.

Inspection name

Description

TestMethodIsPublicVoidNoArg

Marks test methods that are annotated with @Test, but not supplied with a required signature.

StaticSuite

The suite() method was not declared as static

BeforeClassOrAfterClassIsPublicStaticVoidNoArg

Malformed @BeforeClass, @BeforeAll, @AfterClass, or @AfterAll method. Prior to 2022.2, this inspection was disabled.

BeforeOrAfterIsPublicVoidNoArg

Malformed @Before or @After method. Prior to 2022.2, this inspection was disabled.

JUnit5MalformedExtensions

JUnit 5 malformed extension registration

JUnit5MalformedNestedClass

JUnit 5 malformed @Nested class

Junit5MalformedParameterized

Malformed parameterized tests. Prior to 2022.2, this inspection was disabled.

JUnit5MalformedRepeated

JUnit 5 malformed repeated test

JUnitDatapoint

@DataPoint malformed field. Prior to 2022.2, this inspection was disabled.

JUnitRule

Malformed @Rule/@ClassRule field. Prior to 2022.2, this inspection was disabled.

MalformedSetUpTearDown

Malformed setUp() or tearDown() methods. Prior to 2022.2, this inspection was disabled.

UnconstructableTestCase

Reports JUnit test cases that cannot be constructed because they have an invalid constructor. Test cases like these will not be picked up by the JUnit test runner and will therefore not execute. The inspection severity is Warning.

Enabled inspections

Inspection name

Severity

Description

RegExpSimplifiable

Warning

A regular expression like [\wa-z\d] can be simplified to just \w because it already includes a-z as well as numerals.

RegExpSuspiciousBackref

Weak warning

A regular expression like \1(abc) cannot match anything because \1 refers to abc that is not yet defined when evaluating \1. This inspection prevents simple typos in regular expressions, speeding up the editing experience.

BulkFileAttributesRead

Disabled; warning

The 'Files.readAttributes' bulk call can be used instead of multiple file attribute calls

SlowListContainsAll

Warning

Call to list.containsAll may have poor performance

IllegalDependencyOnInternalPackage

Disabled; error

Illegal dependency on internal package

KotlinPlaceholderCountMatchesArgumentCount

Warning

Number of placeholders does not match number of arguments in logging call

NonExhaustiveWhenStatementMigration

Disabled; warning

Non-exhaustive 'when' statements will be prohibited starting from version 1.7

RedundantScheduledForRemovalAnnotation

Warning

Redundant @ScheduledForRemoval annotation

ReplaceOnLiteralHasNoEffect

Warning

Replacement operation has no effect

Removed inspections

Several inspections were also removed from the Qodana Community for Android linter in 2022.2.

Inspection name

Description

AndroidLintAllowBackup

AllowBackup/FullBackupContent Problems.

This inspection was removed due to Android Lint updates.

AndroidLintMediaCapabilities

Missing media capabilities property

Removed due to Android Lint updates

PermissionUsageInspection

Permission Check for Location APIs, an experimental inspection

Last modified: 21 November 2022