Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@arturbosch
Copy link
Member

@arturbosch arturbosch commented May 18, 2020

Basic ideas are:

  • do not register and integrate these tasks by default via the DetektExtension
  • allow to register custom Idea tasks
  • make use of Gradle's exec command instead of a custom process executor

Todo:

  • test tasks via faking the execution like we do with DetektInvoker
  • provide "extension" data class with IdeaCommandLineTask properties and a introduce an apply function IdeaCommandLineTask.apply(IdeaExtension) to share configuration between idea tasks
  • create an issue to migrate to new idea tasks in build files when 1.10.0 is out

import org.gradle.api.tasks.TaskAction
import org.gradle.language.base.plugins.LifecycleBasePlugin

@CacheableTask

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ⚠️ The class DetektIdeaFormatTask is using inheritance, consider using composition instead. Does DetektIdeaFormatTask want to expose the complete interface (empty public interface) of IdeaCommandLineTask such that DetektIdeaFormatTask can be used where IdeaCommandLineTask is expected? Indicates inheritance. Does DetektIdeaFormatTask want only some/part of the behavior exposed by IdeaCommandLineTask? Indicates Composition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mkohm it works :)
You could provide a link to the definition of LCOM everytime you write LCOM.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woho! Now the question is, how useful is it?

I agree on the LCOM, a link could maybe be provided. I will add it to the list of enhancements.

Copy link
Member Author

@arturbosch arturbosch May 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case it was a nice comment to make me think if extracting the common properties of the base class into an data class and introducing a function in the tasks applyFrom(dataClass) would allow users to reduce duplicate code.

val commonProps = DataClass(x, y, z)

tasks.register(DetektIdeaFormat) {
    applyFrom(commonProps)
}
...

However I think when the sub class uses all properties of the base class, the inspection should not report it.

@github-actions
Copy link

Warnings
⚠️

detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/DetektPlugin.kt#L18 - DetektPlugin have a too high LCOM value: 1.0

⚠️

detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/extensions/DetektExtension.kt#L10 - DetektExtension have a too high LCOM value: 0.9523809523809523

⚠️

detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/DetektIdeaInspectionTask.kt#L7 - The class DetektIdeaInspectionTask is using inheritance, consider using composition instead. Does DetektIdeaInspectionTask want to expose the complete interface (empty public interface) of IdeaCommandLineTask such that DetektIdeaInspectionTask can be used where IdeaCommandLineTask is expected? Indicates inheritance. Does DetektIdeaInspectionTask want only some/part of the behavior exposed by IdeaCommandLineTask? Indicates Composition.

Generated by 🚫 Danger Kotlin against c68fee4

@arturbosch arturbosch added this to the 1.10.0 milestone May 18, 2020
@arturbosch arturbosch added the migration Marker to add a migration step in the changelog label May 18, 2020
@arturbosch
Copy link
Member Author

arturbosch commented May 18, 2020

Calling inspect.sh hangs for even 2h and format.sh crashes for me with "container already disposed" without doing anything. Tested with 2019 and 2020 versions...
I think we should deprecate this feature and just reference https://github.com/bentolor/idea-cli-inspector and https://www.jetbrains.com/help/idea/command-line-formatter.html.

@arturbosch arturbosch closed this May 18, 2020
@arturbosch arturbosch deleted the reimplement-idea-integration branch May 18, 2020 16:57
@arturbosch arturbosch removed this from the 1.10.0 milestone May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

migration Marker to add a migration step in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants