SAP / abap-cleaner

ABAP cleaner applies 95+ cleanup rules to ABAP code at a single keystroke
Apache License 2.0
457 stars 48 forks source link

Adjustion alignment of parameters and conditional expressions #343

Open Jules1337dev opened 4 months ago

Jules1337dev commented 4 months ago

In my company the committed coding standard looks like the following examples:

a method call with one parameter is like this: method_call( parameter ).

a method call with two or more parameters is like this.

method_call(
  parameter1 = value1
  parameter2 = value2
).

Conditional expressions would look like

data(integer) = cond #(   
  when 1 = 1
  then 1
  else 2
).

a combination would look like this:

method_call(
  parameter1 = value #(
    column = value1
  )
  parameter2 = value2
).

value is formatted as method calls:

data(struc) = value strucType(
  column1 = value1
  column2 = value2
).
data(lv_current_max_attribute_id) = value id(
  t_situation_attributes[ 1 ]-attribute_id optional 
) + 1.

if the line gets to long, another line break will be done:

data(lv_current_max_attribute_id) = id(
  t_situation_attributes[ 
    lines( t_situation_attributes ) 
  ]-attribute_id optional 
) + 1.

i tried many combinations of the rule "align conditional expressions" and "align parameters and components" but there is no possibility to achive the result above as the cleaner have multiple options to format it to the right, but fewer to the bottom :)

Are there plans to enhance those rules, so that above formatting will be possible?

Root3287 commented 4 months ago

This is like the conversation in the style guide https://github.com/SAP/styleguides/issues/353.

I am in favour of these changes.

Jules1337dev commented 4 months ago

@Root3287 yes, you are absolutely right...

I will leave this issue open, to keep the pressure up :P