larshp / abapOpenChecks

Open source checks for SAP Code Inspector / ABAP Test Cockpit
https://docs.abapopenchecks.org
MIT License
270 stars 79 forks source link

CHECK outside of loop (CHECK 02) should be more smart #1095

Open alezhu opened 1 year ago

alezhu commented 1 year ago

CHECK 02 does not allow CHECK for exit from block except loops. It required RETURN for this. And it used Programming Guideline Only use RETURN to exit procedures) to justify it.

BUT! That guideline has Exception section:

An exception to the rule to only use RETURN to exit procedures are CHECK statements that are located at the beginning of a procedure and that check the prerequisites for the execution of the procedure there. Using the CHECK statement in such a way does not impair the legibility and is thus allowed. However, this exception does not apply to other positions within a procedure and outside loops.

larshp commented 1 year ago

thanks, pull requests welcome