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

Don't exclude the naming rules by default for tests #4438

Merged
merged 3 commits into from Jan 3, 2022
Merged

Conversation

BraisGabin
Copy link
Member

@BraisGabin BraisGabin commented Jan 2, 2022

In general, the rules that apply to good naming patterns in production code can be applied for the test code too. The only exception are the function names. And to be honest that's mainly because of JUnit but I don't want to cross that bridge yet. So this PR remove the excludes for all the rules except FunctionNaming.

I also changed our (not the default one) value for TopLevelPropertyNaming.constantPattern:. Otherwise I would need to do this changes like this that I think that are way worst:

     describe("QualifiedNameProcessor") {
 
         it("fqNamesOfTestFiles") {
-            val ktFile = compileContentForTest(code)
+            val ktFile = compileContentForTest(CODE)
             val processor = QualifiedNameProcessor()
             processor.onProcess(ktFile, BindingContext.EMPTY)
             processor.onFinish(listOf(ktFile), result, BindingContext.EMPTY)
@@ -54,7 +54,7 @@ private val result = object : Detektion {
     }
 }
 
-private const val code = """
+private const val CODE = """
     package io.gitlab.arturbosch.detekt.sample
 
     class Foo {}

closes #4144

@BraisGabin BraisGabin added this to the 1.20.0 milestone Jan 2, 2022
@codecov
Copy link

codecov bot commented Jan 2, 2022

Codecov Report

Merging #4438 (89c63d4) into main (eb0f1cf) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #4438      +/-   ##
============================================
- Coverage     84.32%   84.32%   -0.01%     
  Complexity     3293     3293              
============================================
  Files           472      472              
  Lines         10522    10521       -1     
  Branches       1885     1885              
============================================
- Hits           8873     8872       -1     
  Misses          671      671              
  Partials        978      978              
Impacted Files Coverage Δ
...etekt/generator/printer/defaultconfig/Exclusion.kt 96.66% <100.00%> (-0.11%) ⬇️

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 eb0f1cf...89c63d4. Read the comment docs.

@cortinico cortinico added notable changes Marker for notable changes in the changelog rules labels Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable changes Marker for notable changes in the changelog rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't exlcude tests for naming rules
3 participants