Skip to content

Feature request: Align FORM calls #83

Closed

Description

@ConjuringCoffee

Hi Jörg-Michael, I'd like to request the automatic alignment of FORM calls. As much as I'd like to not work with forms, there's no escape from them in a legacy system... 😅

Activity

  1. jmgrassau commented on Aug 15, 2023

    @jmgrassau
    Member

    Hi ConjuringCoffee,

    funny, actually, that this hasn't already been suggested (including during the Inner Source phase of the project). Maybe that's a good sign… but yes, this would be great to have!

    Kind regards,
    Jörg-Michael

  2. self-assigned this
    on Oct 30, 2023
  3. jmgrassau commented on Nov 1, 2023

    @jmgrassau
    Member

    Hi ConjuringCoffee,

    along with "Algin FORM declarations" (see #84), version 1.10.0 also offers the new cleanup rule "Align PERFORM parameters"! Again, I hope options allow to get the desired outcome; they are inspired by both "Align METHODS declarations" and "Align parameters and components". Defaults are:

    image

    These defaults will change …

    FORM any_form.
      PERFORM any_subroutine_with_a_long_name USING lv_any_value 42 'ABCDEFGHIJKLMN' gc_any_constant '3.14159265'.
    
      PERFORM other_subr
        TABLES lt_any
        USING lt_any_table[] lv_other_table[].
    
      PERFORM third_subr IN PROGRAM any_program TABLES lt_any_table lt_other_table
              USING lv_other_value.
    
      PERFORM (lv_subr_name) IN PROGRAM other_program
      TABLES lr_table_ref->*
        <lt_other_table>
        USING if_any_interface=>co_any_constant
          lo_any_instance->mv_any_attribute
          CHANGING <ls_any_structure>-any_component IF FOUND.
    
      PERFORM (lv_subr_name)  IN PROGRAM (lv_program_name) IF  FOUND
        USING 100  200   300 400   500 600 700 800 " comment
           'abcde' 'fghij' 'klmno' 'pqrst'  'uwvxy'
          gc_any_constant gc_other_constant
       gc_third_constant gc_fourth_constant
        CHANGING lv_any_value lv_other_value.
    
      PERFORM lv_subr_index OF form_one form_two form_three form_four
       form_five form_six form_seven.
    
      " obsolete syntax:
      PERFORM
        subr_name(prog_name)
        IF FOUND
        TABLES lt_any USING
        lv_any_value CHANGING lv_other_value.
    ENDFORM.

    … into:

    FORM any_form.
      PERFORM any_subroutine_with_a_long_name
        USING lv_any_value
              42
              'ABCDEFGHIJKLMN'
              gc_any_constant
              '3.14159265'.
    
      PERFORM other_subr TABLES lt_any
                         USING  lt_any_table[]
                                lv_other_table[].
    
      PERFORM third_subr IN PROGRAM any_program TABLES lt_any_table
                                                       lt_other_table
                                                USING  lv_other_value.
    
      PERFORM (lv_subr_name) IN PROGRAM other_program IF FOUND
        TABLES   lr_table_ref->*
                 <lt_other_table>
        USING    if_any_interface=>co_any_constant
                 lo_any_instance->mv_any_attribute
        CHANGING <ls_any_structure>-any_component.
    
      PERFORM (lv_subr_name) IN PROGRAM (lv_program_name) IF FOUND
        USING    100 200 300 400 500 600 700 800 " comment
                 'abcde' 'fghij' 'klmno' 'pqrst' 'uwvxy' gc_any_constant gc_other_constant gc_third_constant
                 gc_fourth_constant
        CHANGING lv_any_value lv_other_value.
    
      PERFORM lv_subr_index OF form_one
                               form_two
                               form_three
                               form_four
                               form_five
                               form_six
                               form_seven.
    
      " obsolete syntax:
      PERFORM subr_name(prog_name) IF FOUND TABLES   lt_any
                                            USING    lv_any_value
                                            CHANGING lv_other_value.
    ENDFORM.

    As you can see in the fifth example, my impression was that in some cases, you have so many parameters that putting each of them on a distinct line doesn't help readability anymore, hence the last option.

    Kind regards,
    Jörg-Michael

  4. ConjuringCoffee commented on Nov 2, 2023

    @ConjuringCoffee
    ContributorAuthor

    Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions