CLEAR after declaration

 home quick fix  example  edit

clear_after_declaration

Description

Finds CLEAR of a local variable that is still initial since its declaration

Extended Information

Reports CLEAR x. when all of the following hold:

* x is a local variable of a METHOD, FORM or FUNCTION, declared with DATA x TYPE/LIKE ... without VALUE
* the CLEAR is the first reference to x after the declaration, it has no WITH addition
* neither the DATA nor the CLEAR is inside a LOOP, DO, WHILE, SELECT loop, PROVIDE, or a TRY block with
RETRY, RESUME or CATCH BEFORE UNWIND. DATA is not executed per iteration, so a CLEAR in a loop can be needed

Any later use of x does not matter, the CLEAR can only be reached with x still initial.
Objects with syntax errors, macros or unknown statements are skipped, as are procedures with dynamic code,
INCLUDE, test seams, enhancements or native SQL.

The quick fix deletes the CLEAR. No release requirement.

Default Configuration

Hover to see descriptions, Ctrl+Space for suggestions

Examples