-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
Improve naming tests #2094
Conversation
class C(val PARAM: String, private val PRIVATE_PARAM: String) | ||
|
||
class C { | ||
constructor(PARAM: String) {} | ||
constructor(PARAM: String, PRIVATE_PARAM: String) {} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ...
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() | ||
} |
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
* 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
* 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
* 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
This PR is a general refactor in the naming tests. Split tests in different files, simplify some, fix typos, reduce the scope of others...