Skip to content

Improve naming tests #2094

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

Merged
merged 9 commits into from
Nov 25, 2019
Merged

Improve naming tests #2094

merged 9 commits into from
Nov 25, 2019

Conversation

BraisGabin
Copy link
Member

@BraisGabin BraisGabin commented Nov 17, 2019

This PR is a general refactor in the naming tests. Split tests in different files, simplify some, fix typos, reduce the scope of others...

Comment on lines +26 to +31
class C(val PARAM: String, private val PRIVATE_PARAM: String)

class C {
constructor(PARAM: String) {}
constructor(PARAM: String, PRIVATE_PARAM: String) {}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

How does this compile? Two classes with the same name.

Copy link
Member

@arturbosch arturbosch Nov 25, 2019

Choose a reason for hiding this comment

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

Good question. Maybe the type checking step will first trigger redundant names?
Well as this is the scripting compiler everything should be checked ...

Comment on lines 11 to 20
it("should not detect any") {
val code = """
data class D(val i: Int, val j: Int)
fun doStuff() {
val (_, HOLY_GRAIL) = D(5, 4)
emptyMap<String, String>().forEach { _, V -> println(v) }
emptyMap<String, String>().forEach { _, V -> println(V) }
}
"""
assertThat(subject.lint(code)).isEmpty()
assertThat(NamingRules().compileAndLint(code)).isEmpty()
}
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to Remove NamingRulesSpec and move this to its own rule spec... But I don't know which rule is related with this test.

@codecov-io
Copy link

codecov-io commented Nov 17, 2019

Codecov Report

Merging #2094 into master will decrease coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2094      +/-   ##
============================================
- Coverage     80.84%   80.77%   -0.07%     
- Complexity     2008     2009       +1     
============================================
  Files           336      336              
  Lines          5784     5784              
  Branches       1059     1059              
============================================
- Hits           4676     4672       -4     
- Misses          546      547       +1     
- Partials        562      565       +3
Impacted Files Coverage Δ Complexity Δ
...sch/detekt/rules/naming/FunctionParameterNaming.kt 88.88% <0%> (-5.56%) 6% <0%> (-1%)
...tlab/arturbosch/detekt/rules/naming/NamingRules.kt 92.98% <0%> (-5.27%) 18% <0%> (-2%)

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 acc7d14...dd2b464. Read the comment docs.

@BraisGabin BraisGabin marked this pull request as ready for review November 17, 2019 22:19
@arturbosch arturbosch merged commit 3a59a9b into detekt:master Nov 25, 2019
@arturbosch arturbosch added this to the 1.2.1 milestone Nov 25, 2019
arturbosch pushed a commit that referenced this pull request Dec 5, 2019
* Fix test names

* Add missing test in EnumNamingSpec

* Split ParameterNamingSpec

* Don't use NamingRules for the tests

* Remove the cases that are already tested

* Add more annotations Language("kotlin")

* Use compileAndLint

* Use VariableNaming instead of NamingRules

* Extract VariableNamingSpec from NamingRulesSpec
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Fix test names

* Add missing test in EnumNamingSpec

* Split ParameterNamingSpec

* Don't use NamingRules for the tests

* Remove the cases that are already tested

* Add more annotations Language("kotlin")

* Use compileAndLint

* Use VariableNaming instead of NamingRules

* Extract VariableNamingSpec from NamingRulesSpec
smyachenkov pushed a commit to smyachenkov/detekt that referenced this pull request Dec 9, 2019
* Fix test names

* Add missing test in EnumNamingSpec

* Split ParameterNamingSpec

* Don't use NamingRules for the tests

* Remove the cases that are already tested

* Add more annotations Language("kotlin")

* Use compileAndLint

* Use VariableNaming instead of NamingRules

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

Successfully merging this pull request may close these issues.

3 participants