-
-
Notifications
You must be signed in to change notification settings - Fork 769
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 text location: MatchingDeclarationName #2062
Improve text location: MatchingDeclarationName #2062
Conversation
@@ -97,6 +104,14 @@ internal class MatchingDeclarationNameSpec : Spek({ | |||
assertThat(findings).hasLocationStrings("'object O' at (1,1) in /Objects.kt") | |||
} | |||
|
|||
it("should not pass for object declaration even with suppress on the object") { | |||
val ktFile = compileContentForTest("""@Suppress("MatchingDeclarationName") object O""") | |||
ktFile.name = "Objects.kt" |
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.
We could give the compileContentForTest
function or even the (compileAnd)Lint
functions a second parameter filename
so we can skip setting up the name for the KtFile here?
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 just did a little research... Why do we use the functions inside CompileExtensions.kt
? They provide nothing... And why the file is called extensions if they are not extension functions?
I did a fast fix for this PR but I can create (later) a new PR removing that file and using KtTestCompiler
directly. What do you think?
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.
True the naming is kinda odd.
The intention was to not use the KtTestCompiler
directly. compileContentForTest
is more concise for tests.
Codecov Report
@@ Coverage Diff @@
## master #2062 +/- ##
=========================================
Coverage ? 80.36%
Complexity ? 2015
=========================================
Files ? 332
Lines ? 5662
Branches ? 1044
=========================================
Hits ? 4550
Misses ? 559
Partials ? 553
Continue to review full report at Codecov.
|
* Use trimIndent() in MatchingDeclarationNameSpec * Add test to ensure that @Suppress works in MatchingDeclarationName * Improve TextLocation for MatchingDeclarationName * Allow to pass the Filename directly to compileContentForTest
* Use trimIndent() in MatchingDeclarationNameSpec * Add test to ensure that @Suppress works in MatchingDeclarationName * Improve TextLocation for MatchingDeclarationName * Allow to pass the Filename directly to compileContentForTest
No description provided.