-
Notifications
You must be signed in to change notification settings - Fork 656
🐛 Analyzer: too many diagnostics forjs/noDeadCode
#2961
Comments
This is more likely a suggestion rather than a bug, @ematipico, what do you think? Do we need to add another issue type? |
For suggestions, we should use GitHub discussions. We have a "suggestions" category. While I might agree that the messaging can be verbose, I would argue that the counter proposal is too slim for Rome's standards. We pledge to always explain the reason of an error, trying to point to the source of the error. |
It's actually not about the explanation. If you look closely, Rome is currently reporting a separate "before it can reach this code" for every single node/identifier/statement. My suggestion is to combine these into a single reporting span. I found this from a real case here in lodash, where we get a screenful of diagnostics ... |
js/noDeadCode
is overly verbosejs/noDeadCode
This is partially due to a technical limitation in the way the Language Server Protocol represents diagnostics: in order to mark code as "useless" in the editor we need to emit a diagnostic covering that range, but a single diagnostic may only cover one continuous range at once. So when multiple statement or expressions are marked as unreachable in a function, the |
This issue is stale because it has been open 14 days with no activity. |
@leops is there something we can do to close this possible bug? If not a bug, then we should just close it |
I tried to come up with a solution to this a few weeks ago, and I think it would require more time to finish it. I still think this is important though, given how much work is required to implement the solution I would probably re-qualify this from a bug to a missing feature |
This issue is stale because it has been open 14 days with no activity. |
Environment information
Playground
What happened?
Given dead code separated by control blocks, it outputs every single node/identifier/statement as a separate diagnostic.
Expected result
Preferably a single diagnostic for a block of continuous statements.
Let me shamefully show the result of my implementation ...
Code of Conduct
The text was updated successfully, but these errors were encountered: