Skip to content

Bug: ABAP-Cleaner uses CRLF instead of LF #177

Closed

Description

@fmabap

Hello,
I’m working on project where I generate ABAP code with Yeoman. I want to use ABAP-Cleaner command line tool to format the generated code.

The generated code will be uploaded with abapGit as ZIP-File (offline repository) into the SAP-System.
Unfortunately adds the ABAP-Cleaner at the end of each line a CRLF instead of a LF. The coding cannot be deserialized with this.
I’m getting the following error in abapGit.

Error

You can see it in the debugging of the method ZCL_ABAPGIT_OBJECT_CLAS->DESERIALIZE_ABAP variable LT_SOURCE.

crlf

I created a test class with the SE80 for demonstration. I exported it as ZIP file (original.zip) with the abapGit and applied the ABAP-Cleaner on it (cleaned.zip).

cleaned.zip
original.zip

Can you please change the CRLF to LF?

Best regards
Frank

Activity

  1. jmgrassau commented on Oct 30, 2023

    @jmgrassau
    Member

    Hi Frank,

    maybe a solution as in #124 is possible, where @stockbal used git config --global core.autocrlf true to help Git cope with the CRLF? (cp. his workflow shown in GitHub Actions workflow usage)

    Inside ADT, the code is passed to ABAP cleaner with CRLF (at least on Windows), which is why I originally chose to return it that way, too:

    image

    But maybe the best solution for the command line case would be to add a parameter that allows you to select whether you'd like the code to be returned with CRLF or LF – or alternatively, auto-detecting from the input code? (However, this would only work if code documents with only one line end with a line break).

    Kind regards,
    Jörg-Michael

  2. stockbal commented on Oct 30, 2023

    @stockbal
    Contributor

    Hi Jörg-Michael,

    I don't think the git config is a solution here. If I understand Frank correctly he just zip's the local abapGit repo after it was processed via ABAP Cleaner and then uploads it into the SAP system.
    Therefore no commit is executed and git did replace the the crlf with lf line endings.

    A custom cli option to control the line endings would be the best solution in my opinion.

    Regards,
    Ludwig

  3. jmgrassau commented on Oct 30, 2023

    @jmgrassau
    Member

    Hi Ludwig,

    ah, understood, thanks! So probably, since LF seems to be preferred, this command line option could be --crlf, and without it, LF should be used as a default? That would change the behavior, but I guess git config --global core.autocrlf true would continue to work either way, right?

    Kind regards,
    Jörg-Michael

  4. stockbal commented on Oct 30, 2023

    @stockbal
    Contributor

    Hi Jörg-Michael,

    yes, the git line feed conversion should still work

    Kind regards,
    Ludwig

  5. fmabap commented on Oct 30, 2023

    @fmabap
    Author

    Hi Jörg-Michael,
    yes on command line level would be LF as default very helpful.

    My workaround is, that I replace all CRLF with LF in the .ABAP-files with my source code generation tool before I zip it.

    Best regards
    Frank

  6. self-assigned this
    on Oct 31, 2023
  7. jmgrassau commented on Nov 1, 2023

    @jmgrassau
    Member

    Hi Frank and Ludwig,

    thanks for reporting and discussing this issue! In version 1.10.0, which was just released, the cleanup from command line now uses LF as the default, but offers the new option --crlf if CRLF should ever be needed by someone. Documentation was enhanced accordingly.

    Kind regards,
    Jörg-Michael

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