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

useDefaultConfig on tests #6841

Merged
merged 2 commits into from
Jan 21, 2024
Merged

useDefaultConfig on tests #6841

merged 2 commits into from
Jan 21, 2024

Conversation

BraisGabin
Copy link
Member

@BraisGabin BraisGabin commented Jan 9, 2024

Right now the tests of detekt-compiler-plugin relies in an "undefined behavior" of the core. They don't define a configuration nor use useDefaultConfig=true, so no rule should be run. Every rule is disabled by default unless you define the configuration or have useDefaultConfig=true.

I want to refactor how the configuration is created on detekt-core and remove that "undefined behaviour". For that reason I need to fix these tests to pass useDefaultConfig=true.

@BraisGabin
Copy link
Member Author

BraisGabin commented Jan 9, 2024

@3flex do you have any idea how to pass that argument? There was another field for that 🤦‍♂️

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5e5f958) 84.89% compared to head (3d1d494) 85.44%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6841      +/-   ##
============================================
+ Coverage     84.89%   85.44%   +0.54%     
- Complexity     3888     3892       +4     
============================================
  Files           574      574              
  Lines         12919    12919              
  Branches       2448     2448              
============================================
+ Hits          10968    11038      +70     
+ Misses          724      655      -69     
+ Partials       1227     1226       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -95,14 +94,15 @@ val testPluginKotlinc by tasks.registering(Task::class) {
sourceFile.path,
"-Xplugin=${tasks.shadowJar.get().archiveFile.get().asFile.absolutePath}",
"-P",
"plugin:detekt-compiler-plugin:debug=true".toArg(),
"-P",
"plugin:detekt-compiler-plugin:useDefaultConfig=true".toArg(),
Copy link
Member

Choose a reason for hiding this comment

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

Is this necessary? As it seems you're hardcoding the value to true inside CompilerTestUtils

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is. This gradle task is "test" task. But it is not related at all with the unit tests. So I need this too. They are two unrelated codes that relies on that "not defined" behaviour.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh I see, thanks for clarifying

@BraisGabin
Copy link
Member Author

@detekt/maintainers a review here would help a lot I have other PRs pending to this.

@BraisGabin BraisGabin merged commit 36e410b into main Jan 21, 2024
26 checks passed
@BraisGabin BraisGabin deleted the pass-arguments-to-plugin branch January 21, 2024 08:59
@detekt-ci
Copy link
Collaborator

Warnings
⚠️ This PR is approved with no milestone set. If merged, it won't appear in the detekt release notes.

Generated by 🚫 dangerJS against 3d1d494

@cortinico cortinico added this to the 2.0.0 milestone Jan 21, 2024
mgroth0 pushed a commit to mgroth0/detekt that referenced this pull request Feb 11, 2024
* useDefaultConfig on tests

* useDefaultConfig on testPluginKotlinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build compiler-plugin housekeeping Marker for housekeeping tasks and refactorings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants