Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statements should be indented consistently: allow difference for main blocks #1060

Open
stefandrissen opened this issue Jul 6, 2023 · 2 comments

Comments

@stefandrissen
Copy link

stefandrissen commented Jul 6, 2023

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.

@gquerret
Copy link
Contributor

gquerret commented Jul 7, 2023

It could be possible to exclude a list of statements. There are really so many indentation styles when working with the preprocessor !

@cverbiest
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants