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
Add rule to warn on ignored return value #2242
Conversation
Travis tests look like they're failing because I didn't update |
Run |
I ran this, but it didn't seem to result in any changes I could commit. |
Found it. Had to add it to |
I've made some more tweaks, but when testing against my code base I'm running into a lot of incorrect classifications. I'm checking the PsiElement type of each one I find and adding handling for it, but it feels a bit like whack-a-mole and can be hard to differentiate in places where elements are nested multiple levels below where an assignment or something is actually done. I have a feeling my lack of knowledge of the Psi types may be making this more difficult than it needs to be? Are there some useful helpers to differentiate expressions from assignment expressions, etc.? |
Codecov Report
@@ Coverage Diff @@
## master #2242 +/- ##
============================================
+ Coverage 81.38% 81.41% +0.03%
- Complexity 2074 2083 +9
============================================
Files 343 344 +1
Lines 5984 6000 +16
Branches 1086 1091 +5
============================================
+ Hits 4870 4885 +15
Misses 532 532
- Partials 582 583 +1
Continue to review full report at Codecov.
|
Continuing here, because it’s easier than on Slack. |
Ok, this is what I've been doing. Thanks for confirming. |
Also have a look at PsiViewer plugin for IntelliJ which I've found useful. |
Ah! This is super helpful. Thanks! |
@bbaldino do you have an update on this PR? Do you need assistance from our side? |
Sorry for the lack of updates, work has been busy and I haven't had much time to work on this. Where I was hung up, though, was discovering all the different expressions which this should apply to; finding them all and good ways to properly detect them was proving tough. I wondered about |
We haven’t had this case so far. I obviously don’t want to include rules that are buggy into detekt. In your case the rule just doesn’t flag all corner cases, which is okay. I hope that I understood you correctly. |
Yeah that makes sense and is what I was wondering. I still have been a bit strapped for time, but I'll plan on seeing if I can focus on a smaller ruleset which can detect some cases but not give any false positives. |
@bbaldino great! Just pings us if you need help or assistance. |
Since this PR become inactive, I'm wondering if you @bbaldino still plan to work further on this PR. We are open to answer any questions you have. |
Apologies for the radio silence...work got busy and I haven't had time to come back to this--and unfortunately don't think I'll be able to anytime soon. Feel free to close this if you like, I can reopen if I ever get back around to it. |
@bbaldino no worries.. Thanks for the fast reply. I'll put a help wanted tag on this PR in case somebody wants to pick it up and thus help out here. |
@schalkms I can pick this up, can you assign this PR to me? |
All yours ;) and thanks for the help! |
Addresses #2239.
I'd consider this as draft at this point. It works for the test cases I've provided, but I'm not familiar with all of the psi element types and I worry a bit that there may be some I missed (or perhaps a better way to detect what I am detecting).