Background
When invoking "Inspect Code", the results might be missing some warnings/hints/suggestions/errors. Sample problematic word in the editor clearly shows two inspection triggers on that word. But one of the inspections isn't reported in Inspect Code results.
Sample:
It is clearly seen in the editor that the "Inconsistent Naming" reports the issue, but the "Inspect Project" results only report the compiler warning and is missing the naming violation report.
Question 1
How can I inspect a project for a specific inspection rule if "Inspect Code" results might miss some rule violation occasions?
Answer 1
First, one can Inspect a project using the exact inspection one encountered in a code using the "Find similar issues" feature. This will show all the violations of the exact inspection:
Question 2
Why does it happen?
Answer 2
This is actually by design. When an inspection violation is identified in the code, the corresponding part of the code is getting highlighted with a squiggle. Squiggle has startPos and endPos ('range'). Squiggles are designed not to overlap.
When multiple inspections trigger on the same token or overlap with each other by range, Rider intentionally highlights the one with higher severity. This design ensures that the most critical issues are visible and addressed first, preventing less important inspections from cluttering the editor.
Using "Inspect Code" uses similar logic for filtering out the less minor issues (if overlapping happens). More critical inspection often makes it completely useless to address other minor inspections at the same range. E.g. when there is an error saying that string is not allowed as a type argument somewhere, there's no point recommending changing it to String type name as per code style.
Comments
0 comments
Please sign in to leave a comment.