-
Notifications
You must be signed in to change notification settings - Fork 313
Description
Justification
Currently, Code Inspection does not properly distinguish parameters that belong to application events from standard module processes. As a result, Code Inspection can incorrectly recommend the following fixes which if naively followed will violate the event signature contract and cause a compilation error:
- Recommend a parameter of an event can be removed because it is not used in the event process.
- Recommend a parameter of an event can be declared as a
ByVal
when not assigned.
These will result in violations of event contracts. Without this feature there is potential to confuse developers, especially those who are unfamiliar with the strict signature enforcement.
Description
It's not clear if this is a missing feature or a bug.
Additional context
This was noticed after blindly applying a mass fix on the inspection "ParameterCanBeByVal" while working in Excel. As a result, the program could not compile due to Workbook_BeforeClose(ByVal Cancel As Boolean)
being a violation of the signature Workbook_BeforeClose(ByRef Cancel As Boolean)
(or simply Workbook_BeforeClose(Cancel As Boolean)
) and also due to Workbook_BeforeSave(ByVal SaveAsUI As Boolean, ByVal Cancel As Boolean)
being a violation of the signature Workbook_BeforeSave(ByVal SaveAsUI As Boolean, ByRef Cancel As Boolean)
.