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

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

Closed
fmabap opened this issue Oct 30, 2023 · 6 comments
Closed

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

fmabap opened this issue Oct 30, 2023 · 6 comments
Assignees

Comments

@fmabap
Copy link

fmabap commented Oct 30, 2023

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

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

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

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

@stockbal
Copy link
Contributor

Hi Jörg-Michael,

yes, the git line feed conversion should still work

Kind regards,
Ludwig

@fmabap
Copy link
Author

fmabap commented Oct 30, 2023

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

@jmgrassau
Copy link
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
Projects
None yet
Development

No branches or pull requests

3 participants