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

Drop (most) Groovy DSL tests #4687

Merged
merged 5 commits into from Apr 8, 2022
Merged

Drop (most) Groovy DSL tests #4687

merged 5 commits into from Apr 8, 2022

Conversation

3flex
Copy link
Member

@3flex 3flex commented Apr 6, 2022

Closes #4560

There's a new Groovy DSL test in DetektTaskGroovyDslSpec which covers the entire DSL for the extension and the three detekt tasks. It doesn't run the task since many files etc. won't be accessible. Instead, the :help task is run, which compiles the build files. Using tasks.create for these tasks means the tasks will be created & configured even though they're not run.

@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #4687 (1957cae) into main (cc7de61) will not change coverage.
The diff coverage is n/a.

❗ Current head 1957cae differs from pull request most recent head 67f8ade. Consider uploading reports for the commit 67f8ade to get more accurate results

@@            Coverage Diff            @@
##               main    #4687   +/-   ##
=========================================
  Coverage     84.44%   84.44%           
  Complexity     3436     3436           
=========================================
  Files           492      492           
  Lines         11337    11337           
  Branches       2083     2083           
=========================================
  Hits           9573     9573           
  Misses          703      703           
  Partials       1061     1061           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc7de61...67f8ade. Read the comment docs.

""".trimMargin()
)
}
val mainBuildFileContent: String = """
|plugins {
| id "io.gitlab.arturbosch.detekt" apply false
| id("io.gitlab.arturbosch.detekt")
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only behaviour change I had to introduce (here, and again in a later test in this class).

Because of the way Gradle generates type-safe accessors for extensions provided by plugins it's necessary to apply the plugin to the root project so that the detekt extension can be used later in the subprojects block. This doesn't impact the behaviour of the test itself though.

@3flex 3flex added the housekeeping Marker for housekeeping tasks and refactorings label Apr 6, 2022
@3flex 3flex changed the title Drop Groovy DSL tests Drop (most) Groovy DSL tests Apr 6, 2022
Copy link
Member

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

LGTM

@cortinico cortinico added this to the 1.20.0 milestone Apr 7, 2022
@3flex 3flex merged commit 966cc50 into detekt:main Apr 8, 2022
@3flex 3flex deleted the drop-groovy branch April 8, 2022 00:25
chao2zhang pushed a commit that referenced this pull request Apr 8, 2022
* Drop Groovy DSL-based tests where Kotlin DSL-based equivalent exists

* Rewrite remaining Groovy DSL-based tests to use Kotlin DSL

* Add dedicated Groovy DSL test

* Use kotlin dependency extension where possible

* Suppress LongMethod detekt warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Marker for housekeeping tasks and refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop Groovy DSL tests in detekt-gradle-plugin
3 participants