Skip to content

Align METHODS declarations unaligns method declarations #13

Closed

Description

@fabianlupa

Before:

INTERFACE zabc_file_system PUBLIC.
  TYPES:
    file_info_tab TYPE STANDARD TABLE OF file_info WITH KEY filename,
    separator     TYPE c LENGTH 1,
    BEGIN OF connection_info,
      user     TYPE string,
      host     TYPE string,
      protocol TYPE string,
    END OF connection_info.
  METHODS:
    get_supported_methods RETURNING VALUE(result) TYPE zabc_fs_method_enum=>instances,
    get_description RETURNING VALUE(result) TYPE string,
    file_exists IMPORTING path          TYPE csequence
                RETURNING VALUE(result) TYPE abap_bool
                RAISING   zabc_fs_unsupp_operation
                          zabc_file_system_exception,
    read_file_bin IMPORTING path          TYPE csequence
                  RETURNING VALUE(result) TYPE xstring
                  RAISING   zabc_fs_unsupp_operation
                            zabc_file_system_exception,
    read_file_text IMPORTING path          TYPE csequence
                             codepage      TYPE cpcodepage
                   RETURNING VALUE(result) TYPE string
                   RAISING   zabc_fs_unsupp_operation
                             zabc_file_system_exception,
    write_file_bin IMPORTING path    TYPE csequence
                             content TYPE xsequence
                   RAISING   zabc_fs_unsupp_operation
                             zabc_file_system_exception,
    get_directory_contents IMPORTING path          TYPE csequence
                           RETURNING VALUE(result) TYPE file_info_tab
                           RAISING   zabc_fs_unsupp_operation
                                     zabc_file_system_exception,
    create_directory IMPORTING path TYPE csequence
                     RAISING   zabc_fs_unsupp_operation
                               zabc_file_system_exception,
    delete_directory IMPORTING path TYPE csequence
                     RAISING   zabc_fs_unsupp_operation
                               zabc_file_system_exception,
    get_default_codepage RETURNING VALUE(result) TYPE cpcodepage
                         RAISING   zabc_fs_unsupp_operation
                                   zabc_file_system_exception,
    get_separator RETURNING VALUE(result) TYPE separator
                  RAISING   zabc_fs_unsupp_operation
                            zabc_file_system_exception,
    get_connection_info RETURNING VALUE(result) TYPE connection_info
                        RAISING   zabc_fs_unsupp_operation
                                  zabc_file_system_exception.
ENDINTERFACE.

After:

INTERFACE zabc_file_system PUBLIC.
  TYPES:
    file_info_tab TYPE STANDARD TABLE OF file_info WITH KEY filename,
    separator     TYPE c LENGTH 1,
    BEGIN OF connection_info,
      user     TYPE string,
      host     TYPE string,
      protocol TYPE string,
    END OF connection_info.
  METHODS: get_supported_methods RETURNING VALUE(result) TYPE zabc_fs_method_enum=>instances,
           get_description       RETURNING VALUE(result) TYPE string,

    file_exists IMPORTING !path         TYPE csequence
                RETURNING VALUE(result) TYPE abap_bool
                RAISING   zabc_fs_unsupp_operation
                          zabc_file_system_exception,

    read_file_bin IMPORTING !path         TYPE csequence
                  RETURNING VALUE(result) TYPE xstring
                  RAISING   zabc_fs_unsupp_operation
                            zabc_file_system_exception,

    read_file_text IMPORTING !path         TYPE csequence
                             codepage      TYPE cpcodepage
                   RETURNING VALUE(result) TYPE string
                   RAISING   zabc_fs_unsupp_operation
                             zabc_file_system_exception,

    write_file_bin IMPORTING !path   TYPE csequence
                             content TYPE xsequence
                   RAISING   zabc_fs_unsupp_operation
                             zabc_file_system_exception,

    get_directory_contents IMPORTING !path         TYPE csequence
                           RETURNING VALUE(result) TYPE file_info_tab
                           RAISING   zabc_fs_unsupp_operation
                                     zabc_file_system_exception,

    create_directory IMPORTING !path TYPE csequence
                     RAISING   zabc_fs_unsupp_operation
                               zabc_file_system_exception,

    delete_directory IMPORTING !path TYPE csequence
                     RAISING   zabc_fs_unsupp_operation
                               zabc_file_system_exception,

    get_default_codepage RETURNING VALUE(result) TYPE cpcodepage
                         RAISING   zabc_fs_unsupp_operation
                                   zabc_file_system_exception,

    get_separator RETURNING VALUE(result) TYPE separator
                  RAISING   zabc_fs_unsupp_operation
                            zabc_file_system_exception,

    get_connection_info RETURNING VALUE(result) TYPE connection_info
                        RAISING   zabc_fs_unsupp_operation
                                  zabc_file_system_exception.
ENDINTERFACE.

This might resolve itself if the method definition are broken up into multiple statements, which doesn't seem to work currently for interfaces (#12).

Activity

  1. jmgrassau commented on May 21, 2023

    @jmgrassau
    Member

    Hi Fabian,

    not sure what you mean with "unaligns method declarations" here: As far as I can see, the main difference between "Before" and "After" is that empty lines were introduced. This is done intentionally (to improve readability) by the following option in the "Align METHODS declarations" rule (and this one already works on interfaces, too :-)

    image

    If you prefer the "Before" state, you could of course deactivate this option. So, unless I misunderstood your point, I think this issue can be closed, otherwise please let me know, then we can reopen it!

    Kind regards,
    Jörg-Michael

  2. fabianlupa commented on May 21, 2023

    @fabianlupa
    Author

    Sorry I could have simplified the example a bit. I am talking about this part:

    Before

      METHODS:
        get_supported_methods RETURNING VALUE(result) TYPE zabc_fs_method_enum=>instances,
        get_description RETURNING VALUE(result) TYPE string,
        file_exists IMPORTING path          TYPE csequence
                    RETURNING VALUE(result) TYPE abap_bool
                    RAISING   zabc_fs_unsupp_operation
                              zabc_file_system_exception,

    After

     METHODS: get_supported_methods RETURNING VALUE(result) TYPE zabc_fs_method_enum=>instances,
              get_description       RETURNING VALUE(result) TYPE string,
    
        file_exists IMPORTING !path         TYPE csequence
                    RETURNING VALUE(result) TYPE abap_bool
                    RAISING   zabc_fs_unsupp_operation
                              zabc_file_system_exception,

    Before all method definitions were at the same indentation level, after the first two are separated. Though I have no use for any changes as this will not apply anymore to me after #12.

  3. added
    bugSomething isn't working
    and removed on May 21, 2023
  4. jmgrassau commented on May 21, 2023

    @jmgrassau
    Member

    Hi Fabian,

    ah, now I see! Hm, yes, this seems to be a bit of a conflict between ABAP cleaner trying to create one-liners, and on the other hand breaking after METHODS: Will have to look into this!

    Kind regards,
    Jörg-Michael

  5. jmgrassau commented on May 21, 2023

    @jmgrassau
    Member

    Hi Fabian,

    with the above commit, this should be fixed in the next release (version 1.2)!

    Kind regards,
    Jörg-Michael

  6. fabianlupa commented on May 22, 2023

    @fabianlupa
    Author

    By the way: Love the responsiveness to the issues! I would recommend to pick a different approach to closing them though. Having the fixes on a main branch in a fork that is presumeably merged some time in the future discourages people from contributing as the code base in the base repo is outdated and you cannot see pending changes directly either.

  7. self-assigned this
    on Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions