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

Procedure can be written as function - RD ver 2.0.8 #2179

Closed
peterennis opened this issue Aug 6, 2016 · 11 comments · Fixed by #2215
Closed

Procedure can be written as function - RD ver 2.0.8 #2179

peterennis opened this issue Aug 6, 2016 · 11 comments · Fixed by #2215
Assignees
Labels
bug Identifies work items for known bugs feature-inspections inspection-false-positive A bug where an inspection result appears, even though it is incorrect.
Milestone

Comments

@peterennis
Copy link

Sub is used for Ribbon callbacks.
Ref: https://msdn.microsoft.com/en-us/library/aa942866.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
The opportunity recommendation is false in this case.
Also:
Ref: https://social.msdn.microsoft.com/Forums/office/en-US/2c33d20a-b010-4a65-a0c9-762bfd7c0122/ribbon-callback-function?forum=accessdev

capture57

@peterennis
Copy link
Author

Disable this inspection does not do anything.

capture58

@retailcoder
Copy link
Member

Disabling an inspection writes to the inspection settings file and sets the selected inspection's severity to do not show - and then it's supposed to refresh the inspection results.

Can you confirm the severity level was not set to do not show? Or is it just a refreshing issue?

@retailcoder
Copy link
Member

Ribbon callbacks are a problem, we have no way of knowing that they're callbacks as of yet; they're prime candidates for an @Ignore annotation (which the ignore once quick-fix should insert automatically).

@peterennis
Copy link
Author

Settings here:
capture59

@peterennis
Copy link
Author

"Consider renaming variable" - I could not find a setting and disable the inspection also does nothing.

@peterennis
Copy link
Author

@retailcoder - Where do I get details on use of '@ignore ?
Here: #810
It refers to magic comments and what appears to be magic ignore types/variable definitions.

An option to completely @ignore all inspections in a particular module would be useful. Especially where the module is dev/test/poc code.
capture60

@ThunderFrame
Copy link
Member

ThunderFrame commented Aug 7, 2016

I have some proof-of-concept code for pulling the callback names out of Office Open XML documents, and it could probably be made to work with some types of Access CustomUI XML too. It won't be able to handle callbacks in dynamic menus, but that's a bit like asking RD to parse arguments to Application.Run

@retailcoder
Copy link
Member

@peterennis @Ignore annotations are introduced by the ignore once quick-fix, and the inspections use them to determine whether to issue an inspection result at a given declaration or identifier reference. They work with the inspection names RD uses internally, which makes them non-trivial to introduce manually. For example using ignore once on a VariableNotUsedInspection inspection result would add an annotation above the variable's declaration:

'@Ignore VariableNotUsed
Dim foo As String

@Vogel612 Vogel612 added bug Identifies work items for known bugs feature-inspections status-deferred There is no way to implement this right now, but the team wants to do it. technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point. labels Aug 30, 2016
@Vogel612
Copy link
Member

Added some relevant Labels. Especially relevant here is the fact that we cannot tell Ribbon Callbacks are just that. As such this is maybe better off as [status-bydesign]. Then again what's not can still be

@retailcoder retailcoder removed status-deferred There is no way to implement this right now, but the team wants to do it. technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point. labels Sep 4, 2016
@retailcoder retailcoder added this to the Version 2.0 milestone Sep 4, 2016
@retailcoder retailcoder self-assigned this Sep 4, 2016
retailcoder added a commit to retailcoder/Rubberduck that referenced this issue Sep 4, 2016
@retailcoder
Copy link
Member

There were two problems here: ProcedureCanBeWrittenAsFunction is a ParseTree inspection that runs directly off each ANTLR IParseTree, as part of the parsing process - these parse tree inspections did not honor the DoNotShow severity level. The other problem was that the inspection didn't honor the @Ignore ProcedureCanBeWrittenAsFunction attribute. Both problems are fixed with #2215.

@retailcoder
Copy link
Member

That said, RD still can't tell a Ribbon callback from any other procedure that's not used, and therefore cannot specifically exclude Ribbon callback procedures from its results. This is a known issue though.

@retailcoder retailcoder added the inspection-false-positive A bug where an inspection result appears, even though it is incorrect. label Aug 11, 2017
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 feature-inspections inspection-false-positive A bug where an inspection result appears, even though it is incorrect.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants