Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UselessCallOnNotNull doesn't report #2037

Closed
CuiLam opened this issue Oct 18, 2019 · 9 comments
Closed

UselessCallOnNotNull doesn't report #2037

CuiLam opened this issue Oct 18, 2019 · 9 comments
Labels

Comments

@CuiLam
Copy link

CuiLam commented Oct 18, 2019

I wrote val testList = listOf("string").orEmpty() in my code, but detekt can not find it.

@3flex
Copy link
Member

3flex commented Oct 18, 2019

Can you please take a look at my comment on #2036 and see if it similarly describes your issue?

@CuiLam
Copy link
Author

CuiLam commented Oct 21, 2019

yes, it 's sinilarly

@CuiLam
Copy link
Author

CuiLam commented Oct 23, 2019

so now what can I do

@3flex
Copy link
Member

3flex commented Oct 23, 2019

We need to write docs so users know how to run detekt so all rules run as expected.

We're aware, just need to find the time to work on it.

If using Gradle try running detektMain task.

@CuiLam
Copy link
Author

CuiLam commented Oct 25, 2019

When i running detektMain tash, it report

Script compilation errors:

Line 23: plugins {
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline operator fun <T : Any, C : NamedDomainObjectContainer<TypeVariable(T)>> TypeVariable(C).invoke(configuration: NamedDomainObjectContainerScope<TypeVariable(T)>.() -> Unit): TypeVariable(C) defined in org.gradle.kotlin.dsl
public operator fun Closure<TypeVariable(T)>.invoke(): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun Closure<TypeVariable(T)>.invoke(x: Any?): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun Closure<TypeVariable(T)>.invoke(vararg xs: Any?): TypeVariable(T) defined in org.gradle.kotlin.dsl
public operator fun Callable<TypeVariable(V)>.invoke(): TypeVariable(V) defined in org.gradle.kotlin.dsl
public inline operator fun Action<in TypeVariable(T)>.invoke(target: TypeVariable(T)): Unit defined in org.gradle.kotlin.dsl
public operator fun NamedDomainObjectProvider<TypeVariable(T)>.invoke(action: TypeVariable(T).() -> Unit): Unit defined in org.gradle.kotlin.dsl
@Incubating public operator fun ArtifactHandler.invoke(configuration: ArtifactHandlerScope.() -> Unit): Unit defined in org.gradle.kotlin.dsl
@Incubating public operator fun DependencyConstraintHandler.invoke(configuration: DependencyConstraintHandlerScope.() -> Unit): Unit defined in org.gradle.kotlin.dsl
public inline operator fun ExtraPropertiesExtension.invoke(initialValueProvider: () -> TypeVariable(T)): InitialValueExtraPropertyDelegateProvider<TypeVariable(T)> defined in org.gradle.kotlin.dsl
public operator fun ExtraPropertiesExtension.invoke(initialValue: TypeVariable(T)): InitialValueExtraPropertyDelegateProvider<TypeVariable(T)> defined in org.gradle.kotlin.dsl
public operator fun Spec<TypeVariable(T)>.invoke(arg: TypeVariable(T)): Boolean defined in org.gradle.kotlin.dsl
public inline operator fun TaskContainer.invoke(configuration: TaskContainerScope.() -> Unit): TaskContainer defined in org.gradle.kotlin.dsl

Line 24: id("com.jfrog.artifactory") version artifactoryVersion
^ Unresolved reference: id

Line 25: id("com.jfrog.bintray") version bintrayVersion
^ Unresolved reference: id

Line 26: id("com.gradle.build-scan") version buildScanVersion
^ Unresolved reference: id

Line 27: id("org.jetbrains.dokka") version dokkaVersion
^ Unresolved reference: id

Line 28: id("com.github.ben-manes.versions") version gradleVersionsPluginVersion
^ Unresolved reference: id

Line 29: kotlin("jvm") version kotlinVersion
^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun DependencyHandler.kotlin(module: String, version: String? = ...): Any defined in org.gradle.kotlin.dsl
public fun PluginDependenciesSpec.kotlin(module: String): PluginDependencySpec defined in org.gradle.kotlin.dsl

Line 30: id("com.github.johnrengelman.shadow") version shadowVersion
^ Unresolved reference: id

Line 31: id("org.sonarqube") version sonarQubeVersion
^ Unresolved reference: id

9 errors

@dive5617
Copy link

dive5617 commented Oct 25, 2019

so all rules work well in v1.1.1. Issues for example #2043 are caused by users don't know how to run it correctly even for android project. Is that right? @3flex

@3flex
Copy link
Member

3flex commented Oct 25, 2019

@CuiLam those errors are Gradle script compilation errors which don't look related to detekt itself, are you using Gradle to build your project or just trying to run the detekt Gradle task?

@dive5617 basically yes. We need to make a couple more improvements then write docs.

@CuiLam
Copy link
Author

CuiLam commented Nov 27, 2019

I can't run detekyMain in my android project, so how can I do that

@schalkms
Copy link
Member

schalkms commented Feb 7, 2020

#2259 shows how to run detektMain on Android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants