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
{{ message }}
Repository navigation
Question: is there a mechanism to prevent cleanup of certain legacy includes or code sections? #121
so far, there are no pseudo-comments for ABAP cleaner, simply because I don't think anyone would want yet another set of them (already having ##PRAGMA, "#EC ..., "#EC CI_... etc.).
However, my impression is that indeed such pseudo-comments or tags are not needed yet, because the cleanup rules always check whether an ABAP statement matches the "expected syntax" before they apply any changes to it. Therefore, if a statement is in some way unexpected (because of obsolete syntax, comments in weird places, unorthodox coding style etc.), the cleanup rules would simply leave that statement unchanged.
Also, cleanup rules that introduce newer ABAP syntax (such as += assignment operators, or NEW operators) are automatically skipped if the code belongs to an older ABAP release which does not support these constructs.
Nevertheless, this may be worth some remarks in the documentation! And if you come across concrete examples, please let us know. Maybe some cases could also be solved with additional options that specifically exclude certain older syntax or contexts etc.
I now added a section in the documentation for the Main Window:
Hope this approach continues to work! The ideal case would be that after some initial selection and configuration of the cleanup rules, users of ABAP cleaner can be sure that whenever they press Ctrl+4, their code gets better (or at least not worse), without them having to check the changes. Where that's not the case, we'd continue to fine-tune the cleanup rules.
Kind regards,
Jörg-Michael
Reacted by Abo, ConjuringCoffee, Mehmet Dağnilak and JoachimRees
thanks for opening this issue! The enhanced documentation was now added to this repo. (Not expecting everyone to read all documentation first, but at least now we have a place to point to if the question comes up again :-)
My intended use case was a different one (but as I wrote: I am not yet sure whether it turns out to be relevant in practice):
When a developer (especially in an SAP customer context) does not want "his" code to be "improved" by others.
For example, we have had a case where an external developer completely refactored (manually) the code of an internal developer, which lead to some (avoidable) negative emotions.
Because using ABAP Cleaner is so quick and easy, developers might always use it whenever they change a single line of "someone else's" coding.
Of course, this can also be addressed via a section in the Coding Guideline "How to use ABAP Cleaner".
I will contact you again, if this turns out to be an important use case for us.
thanks for the explanation. Yes, I'd also say this is rather a case for internal alignment or guidance ("How to use ABAP cleaner") than for a pseudo-comment that "protects" code from being processed with ABAP cleaner. Anyway, that well-meaning, overeager external developer would soon discover how to remove such a pseudo-comment…
Activity
jmgrassau commentedon Sep 30, 2023
Hi Edo,
so far, there are no pseudo-comments for ABAP cleaner, simply because I don't think anyone would want yet another set of them (already having
##PRAGMA,"#EC ...,"#EC CI_...etc.).However, my impression is that indeed such pseudo-comments or tags are not needed yet, because the cleanup rules always check whether an ABAP statement matches the "expected syntax" before they apply any changes to it. Therefore, if a statement is in some way unexpected (because of obsolete syntax, comments in weird places, unorthodox coding style etc.), the cleanup rules would simply leave that statement unchanged.
Also, cleanup rules that introduce newer ABAP syntax (such as
+=assignment operators, orNEWoperators) are automatically skipped if the code belongs to an older ABAP release which does not support these constructs.Nevertheless, this may be worth some remarks in the documentation! And if you come across concrete examples, please let us know. Maybe some cases could also be solved with additional options that specifically exclude certain older syntax or contexts etc.
Kind regards,
Jörg-Michael
jmgrassau commentedon Oct 1, 2023
Hi Edo,
I now added a section in the documentation for the Main Window:
Hope this approach continues to work! The ideal case would be that after some initial selection and configuration of the cleanup rules, users of ABAP cleaner can be sure that whenever they press Ctrl+4, their code gets better (or at least not worse), without them having to check the changes. Where that's not the case, we'd continue to fine-tune the cleanup rules.
Kind regards,
Jörg-Michael
add documentation on missing pragmas and pseudo-comments (SAP#121)
add documentation on missing pragmas and pseudo-comments (#121)
jmgrassau commentedon Oct 2, 2023
Hi Edo,
thanks for opening this issue! The enhanced documentation was now added to this repo. (Not expecting everyone to read all documentation first, but at least now we have a place to point to if the question comes up again :-)
Kind regards,
Jörg-Michael
vonglan commentedon Oct 4, 2023
Hi Jörg-Michael,
that is a good decision about pseudo-comments.
My intended use case was a different one (but as I wrote: I am not yet sure whether it turns out to be relevant in practice):
When a developer (especially in an SAP customer context) does not want "his" code to be "improved" by others.
For example, we have had a case where an external developer completely refactored (manually) the code of an internal developer, which lead to some (avoidable) negative emotions.
Because using ABAP Cleaner is so quick and easy, developers might always use it whenever they change a single line of "someone else's" coding.
Of course, this can also be addressed via a section in the Coding Guideline "How to use ABAP Cleaner".
I will contact you again, if this turns out to be an important use case for us.
Thanks,
Edo
jmgrassau commentedon Oct 5, 2023
Hi Edo,
thanks for the explanation. Yes, I'd also say this is rather a case for internal alignment or guidance ("How to use ABAP cleaner") than for a pseudo-comment that "protects" code from being processed with ABAP cleaner. Anyway, that well-meaning, overeager external developer would soon discover how to remove such a pseudo-comment…
Kind regards,
Jörg-Michael