You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
You can see it in the debugging of the method ZCL_ABAPGIT_OBJECT_CLAS->DESERIALIZE_ABAP variable LT_SOURCE.
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).
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:
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).
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.
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?
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.
Activity
jmgrassau commentedon Oct 30, 2023
Hi Frank,
maybe a solution as in #124 is possible, where @stockbal used
git config --global core.autocrlf trueto 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:
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 commentedon Oct 30, 2023
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
crlfwithlfline endings.A custom cli option to control the line endings would be the best solution in my opinion.
Regards,
Ludwig
jmgrassau commentedon Oct 30, 2023
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 guessgit config --global core.autocrlf truewould continue to work either way, right?Kind regards,
Jörg-Michael
stockbal commentedon Oct 30, 2023
Hi Jörg-Michael,
yes, the git line feed conversion should still work
Kind regards,
Ludwig
fmabap commentedon 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
add command line option --CRLF; use LF as default line separator (SAP…
add command line option --CRLF; use LF as default line separator (#177)
jmgrassau commentedon Nov 1, 2023
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
--crlfif CRLF should ever be needed by someone. Documentation was enhanced accordingly.Kind regards,
Jörg-Michael