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

Align METHODS declarations unaligns method declarations #13

Closed
fabianlupa opened this issue May 19, 2023 · 5 comments
Closed

Align METHODS declarations unaligns method declarations #13

fabianlupa opened this issue May 19, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@fabianlupa
Copy link

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

@jmgrassau
Copy link
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

@fabianlupa
Copy link
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.

@jmgrassau jmgrassau reopened this May 21, 2023
@jmgrassau jmgrassau added bug Something isn't working and removed no defect labels May 21, 2023
@jmgrassau
Copy link
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

jmgrassau added a commit to jmgrassau/abap-cleaner that referenced this issue May 21, 2023
@jmgrassau
Copy link
Member

Hi Fabian,

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

Kind regards,
Jörg-Michael

@fabianlupa
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants