abapOpenChecks icon indicating copy to clipboard operation
abapOpenChecks copied to clipboard

ATC Check 69: If no routine using/changing/tables parameter prefix is defined, then local prefixes are used

Open cavabap opened this issue 3 years ago • 2 comments

In our system we have no guidelines for prefixing of routine variables. Actually routines shouldn't be used... There we don't want to check the FORM prefixes. However when we supply no rule, then local prefixes are being used,

grafik This leads to false positives. grafik

according to my debugging (and I don't know the code well) it seems that if no scope (which are the parameters we configured) then the scope is determined. And for FORM the scope is always locals. The keyword is never considered - because it is always FORM and not USING/CHANGING/TABLES?

This determination seems to happen, whenever the scope is initial. adt:///sap/bc/adt/oo/classes/zcl_aoc_check_69/source/main#start=978,0;end=982,10 While the decision that any form is local happens here. adt:///sap/bc/adt/oo/classes/zcl_aoc_check_69/source/main#start=1003,4;end=1006,40

At first I thought a workaround is to provide an explicit scope of '*' - but this causes the regex to raise an exception and its looks no further ATC coding scanning occurs. My current workaround to supply all kind of sensible prefixes - but this isn't ideal.

Also this doesn't seem to be required elsewhere (such as in the statics section). This is because in determine_scope_prefix there is an exception for lv_keyword = 'STATICS'. However for FORMS the keyword USING is not available for consideration.

cavabap avatar Oct 01 '21 10:10 cavabap

How are you test these checks? Are there default test programs your using?

cavabap avatar Oct 04 '21 10:10 cavabap

manually 😓

some of this is difficult to test, as I dont want to install bad/example/test code in the target systems

larshp avatar Oct 04 '21 10:10 larshp