VBA.Array() Inspection #6212
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
What
An inspection that locates qualified
VBA.Array()
function calls to warn about possibly unexpected behavior; depending on how it's implemented this one could be a hint under language opportunities, or a warning under code quality, ...or both 😃Why
Qualified
VBA.Array()
function calls yield an array that is always zero-based, but unqualified 'Array()' yields an array that is one-based givenOption Base 1
.Option Base 1
is specified, qualifiedVBA.Array()
calls become inconsistent zero-based arrays in a module where implicitly-sized arrays can reasonably be assumed to be one-based.Option Base 1
is NOT specified, qualifyingVBA.Array()
calls should warn/hint about the behavior being different than that of an unqualifiedArray()
call.Example
This code should trigger the inspection:
QuickFixes
Rubberduck could offer to remove the qualifier, albeit with a disclaimer that doing so may introduce off-by-one errors if the code makes any assumptions about array boundaries: it changes what the code does, not just how it does it.
The text was updated successfully, but these errors were encountered: