sonar-openedge
sonar-openedge copied to clipboard
Statements should be indented consistently: allow difference for main blocks
We have quite some conditional compilation as follows:
function foo returns logical (
):
return true.
end function.
&if somecondition &then
function bar returns logical (
):
return true.
end function.
&else
function nobar returns int64 (
):
return 0.
end function.
&endif
These are being flagged by the consistent indent rule. Could this rule be fine tuned to allow discrepancies on main block statements such as:
- function
- procedure
- method
method
is less of an issue since they are normally all indented, allowing room for an outdented preprocessor. I did however have one case where I thought it made no sense indenting everything except for the class
/ end class
statements so thought it would be useful to put the method
statements at the beginning of the line.
It could be possible to exclude a list of statements. There are really so many indentation styles when working with the preprocessor !
@gquerret I agree , e.g. we try to indent ABL independent from &preprocessor
&if {&condition1}
&then
&if {&condition2}
&then
procedure A:
end procedure.
&else
procedure A:
end procedure.
&endif
&endif
It's more readable when looking at preprocessed code, but it's hard to maintain if a lot of preprocessor conditions are involved.