-
-
Notifications
You must be signed in to change notification settings - Fork 767
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
Better handling for the Suppresion of errors #2013
Better handling for the Suppresion of errors #2013
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2013 +/- ##
============================================
+ Coverage 80.71% 80.71% +<.01%
Complexity 1985 1985
============================================
Files 329 329
Lines 5590 5591 +1
Branches 1021 1020 -1
============================================
+ Hits 4512 4513 +1
Misses 539 539
Partials 539 539
Continue to review full report at Codecov.
|
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.
Looks good to me.
I guess the new function could be element.getNonStrictParentOfType<KtElement>()
Could you add a testcase for SpacingBetweenPackageAndImports
. I'm not sure how the Psi mixes the different kind of elements and if we really can expect a LeafPsiElement.parent
to reach a KtElement
.
I can't implement something like But I renamed the function to: I debugged the Reading this: https://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/psi_files.html the As a side effect we could change |
🤦♂ I just realised that the function |
I think that the fails of this PR was a problem in the travis end. |
I would let the KtElement inside a
|
Right now Move The only "problem" in this PR is this line: val ktElement = element.getNonStrictParentOfType<KtElement>()!! The use of |
Ah right! |
I added a regresion with #1977. Luckly it was not released yet.
enumEntry.nameIdentifier
is not aKtElement
so it's not setted in theEntity.ktElement
. Right now the only use of that theKtElement
is to check if there is a@Suppress
annotation. So if it was null, you can't@Suppress
. With this PR I fix that.I'm fixing more than that so, please, check if this is correct. What I'm doing is that, instead of checking if the current element is a
KtElement
I look for the nearestKtElement
parent. This way, other warnings asSpacingBetweenPackageAndImports
can use@Supress
too.Maybe I'm breaking the API for the plugins. If you think so, I can implement this without any api change.