[[Property:title|CA005 - Useless object test local]]
[[Property:link_title|CA005]]
[[Property:weight|0]]
[[Property:uuid|56a54ef0-48e8-b58f-ac2c-09074782b9f7]]
__NOTOC__
=Description=
For local variables and feature arguments it is unnecessary to use an object test to check their attachment status.
:{| class="doctable"
|-
| '''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