abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

"Remove needless spaces" doesn't consider spaces between parameter and method parenthesis

Open ConjuringCoffee opened this issue 2 years ago • 3 comments

Hi Jörg-Michael, I found an example that isn't covered by the rule. Is it simply not covered at all, or did I overlook another rule that should have done this?

Example:

    DATA(lo_example) = NEW lcl_example( iv_1 = 1
                                        iv_2 = 1        ).

Expected:

    DATA(lo_example) = NEW lcl_example( iv_1 = 1
                                        iv_2 = 1 ).

ConjuringCoffee avatar Nov 07 '23 12:11 ConjuringCoffee

I'm using the following options:

image

ConjuringCoffee avatar Nov 07 '23 12:11 ConjuringCoffee

Hi ConjuringCoffee,

that's a good point. One possible place for this would be the "Align parameters and components" rule, but I did not want to condense the space before the closing parenthesis there, because this rule does not consider the context of multiple table rows – and someone may want to keep alignment like this:

  lt_any_table = VALUE #( ( id = 1 name = 'any'       )
                          ( id = 2 name = 'other'     )
                          ( id = 3 name = 'very_long' ) ).

However, "Remove needless spaces" does consider the context above and below, so this rule could actually do this, because it could detect whether or not there are more closing parentheses in the same position that might be aligned intentionally. And in non-table-row cases, I guess there should be no reason to keep multiple spaces before the closing parenthesis anyway.

Kind regards, Jörg-Michael

jmgrassau avatar Nov 09 '23 08:11 jmgrassau

Possibly related to this eventual new cleanup rule #67.

sandraros avatar Dec 11 '23 14:12 sandraros