Skip to content
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

disable adding @Ignore comments into code #6225

Open
noambrand opened this issue Sep 22, 2024 · 4 comments
Open

disable adding @Ignore comments into code #6225

noambrand opened this issue Sep 22, 2024 · 4 comments
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-inspections up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

Comments

@noambrand
Copy link

What
Under options add "disable adding comments into code"

Why
I do not want Rubberduck comments in my code, but do want the ability to ignore some inspections (not one by one).
That will help make the list of remaining things to check more focused.

Example
'@ignore ImplicitPublicMember
'@ignore UseMeaningfulName
'@ignore UseMeaningfulName, MultipleDeclarations

@noambrand noambrand added enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-inspections up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky labels Sep 22, 2024
@retailcoder
Copy link
Member

retailcoder commented Sep 22, 2024

Hi, thanks for the feedback!

I'm not sure I understand the feature being requested here; the way I'm reading it there would be a new option that, if enabled, would disable or remove the "ignore once" quick-fix from the inspection results' "fix" menu?

Rubberduck does not add comments to your code without you telling it to do exactly that, so I'm not sure how disabling Ignore Once would be functionally any different from not opting to apply the IgnoreOnce quickfix for a given inspection/result? What if an annotation was manually added (they're just comments, they can be typed)?

What is the motivation behind the feature? Is it that the code has a bunch of scattered "ignore" annotations everywhere and it would be nice to have a way to quickly find (and remove?) them?

I do not want Rubberduck comments [...], want the ability to ignore inspections (not one by one).

Not sure if this is referring to inspections or inspection results, but to ignore an inspection you can disable it by setting its severity level to DoNotShow (then it won't run at all, so won't issue any results); to ignore the results of an inspection "one by one" would be what the IgnoreOnce quick-fix does, but then IgnoreInModule silences (or should be silencing anyway) all results in that module, but it does this by adding an @IgnoreModule annotation comment in the declarations section. But that would be a no-go if we don't want any annotation comments anywhere.

Basically I'm all ears, but I'd need to better understand the use case.

There is no way to just "dismiss" a result and then to remember it was dismissed, because each run is entirely independent of any preceding run, and results are associated to parse tree nodes, which are invalidated whenever the code changes in any way: the way Rubberduck can remember to not issue a particular inspection result is by annotating the code being inspected so that an inspection knows to skip a node that's associated with an IgnoreAnnotation.

@noambrand
Copy link
Author

noambrand commented Sep 22, 2024 via email

@retailcoder
Copy link
Member

Instead, I want to be able to ignore all occurrences across the entire
project or module without inserting any comments. I’m not referring to
disabling specific inspections with DoNotShow, but rather applying fixes or
ignoring results without adding comments or annotations in the code.

We could add a "dismiss result" feature that removes a result (or a bunch!) from the list without annotating the code. It would clean up the toolwindow, ...but only until the inspections run again... which I don't think would be useful.

The problem is that something somewhere has to remember that a given result is to be ignored, and inspection results don't do that because they are tied to a single parse run; as soon as the code changes in any way, they're flushed and regenerated from the new/updated code and parse trees. The thing that associates a result with its location in the source code is the parser tokens, and they are not mutable so there isn't really any way to keep inspection results around and re-link them to updated token locations; if a tree is invalidated, so are all its inspection results. Without an annotation comment to tell an inspection to not issue a result at a given location, there is no way (none that would be reliable anyway) to say "there was a result here before and it was dismissed so don't reissue it now". An inspection doesn't know anything about its previous-run results.

The 2.x approach with inspections dates all the way back to v1, where all inspections would traverse and inspect all parse trees after a successful run, aggregating results in one giant bag. v3.0 will change this by basically eliminating inspections, replacing them with language server diagnostics. Sounds similar, but the LSP paradigm makes everything very different, and diagnostics will be fully decoupled from parse trees and their tokens, making it much simpler to correctly manage. It would not be something possible with 2.x, at least not without fundamentally changing how things work.

@noambrand
Copy link
Author

noambrand commented Sep 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, or enhancements to existing features. Ideas. Anything within the project's scope. feature-inspections up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Projects
None yet
Development

No branches or pull requests

2 participants