CA005 - Useless object test local

Description

For local variables and feature arguments it is unnecessary to use an object test to check their attachment status.

Scope feature
Status Enabled
Severity Suggestion
Applicability All
Score 40

Example of violation

if attached a_local as another_local then another_local.do_something end

Recommendation

Remove the object test local, or replace the object test and use a comparison to Void.

In the example, it can simply be: if attached a_local then a_local.do_something end

or

if a_local /= Void then a_local.do_something end

cached: 03/19/2024 12:33:45.000 AM