Skip to content

False positive: UnconditionalJumpStatementInLoop with elvis operator ?: #2388

@BraisGabin

Description

@BraisGabin

Expected Behavior

The elvis operator is a conditional so code like this should be accepted:

for (resource in Detektor::class.java.classLoader.getResources("META-INF/MANIFEST.MF")) {
    return runCatching { readVersion(resource) }.getOrNull() ?: continue
}

Observed Behavior

It fails

Context

We found this false positive at #2387

Your Environment

  • Version of detekt used: 1.6.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions