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

IgnoreModule does not work for "Public Member name contains an underscore" inspection #4965

Closed
ghost opened this issue May 21, 2019 · 4 comments · Fixed by #5185
Closed

IgnoreModule does not work for "Public Member name contains an underscore" inspection #4965

ghost opened this issue May 21, 2019 · 4 comments · Fixed by #5185
Assignees
Labels
bug Identifies work items for known bugs difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. feature-annotations feature-inspections good first issue Want to contribute? That's a good place to start! hacktoberfest Tags issues for Hacktoberfest 2019 up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

Comments

@ghost
Copy link

ghost commented May 21, 2019

Rubberduck version information
Version 2.4.1.4719
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office x64
Host Version: 16.0.11629.20136
Host Executable: WINWORD.EXE

Description
As per the title. I have a number of Modules and classes with the '@IgnoreModule annotation. Where the Module is a '@testmodule, it is hidden from code inspections. Where '@IgnoreModule is in a normal Class or Module the respective Class or Module is not ignored for code inspections.

vbWatchdog generates a lot of code inspections.....

@ghost ghost added the bug Identifies work items for known bugs label May 21, 2019
@ghost
Copy link
Author

ghost commented Jun 5, 2019

Following my comment on #4990 I've done a bit more investigation. It seems that there is a specific inspection which is not ignored by '@IgnoreModule'. This inspection result is the 'Public member name contains an underscore. Unfortunately, vbWatchdog seems to have a large number of this type of memeber.

@Vogel612 Vogel612 changed the title Annotation:IgnoreModule: Ignores TestModules but not normal Classes or Modules IgnoreModule does not work for "Public Member name contains an underscore" inspection Jun 5, 2019
@Inarion
Copy link
Contributor

Inarion commented Jun 12, 2019

Just for completeness' sake: The inspection is not only ignoring '@IgnoreModule annotations but also when we explicitly set '@Ignore UnderscoreInPublicClassModuleMember for the respective procedure.

(And yes, I've also stumbled upon this due to vbWatchdog.) :)

@Vogel612 Vogel612 added difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky labels Jun 12, 2019
@Vogel612
Copy link
Member

This should be pretty straightforward. We only need to check whether the inspection result is isngored for the module or member within the inspection.

Something like the following needs to be put into the inspection.

return nodes
.Where(issue => !issue.IsIgnoringInspectionResultFor(AnnotationName)
// Ignoring the Declaration disqualifies all assignments
&& !issue.Declaration.IsIgnoringInspectionResultFor(AnnotationName))
.Select(issue => new IdentifierReferenceInspectionResult(this, Description, State, issue))
.ToList();

@Vogel612 Vogel612 added the good first issue Want to contribute? That's a good place to start! label Jun 12, 2019
@MDoerner
Copy link
Contributor

I really think we should move these checks to the base class or let the results expose a property indicating whether they are ignored and filter on that in the inspection base class.

It is just too easy to forget to implement this filtering in every inspection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs difficulty-02-ducky Resolving these involves the internal API, but with relatively easy problems to solve. feature-annotations feature-inspections good first issue Want to contribute? That's a good place to start! hacktoberfest Tags issues for Hacktoberfest 2019 up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants