Skip to content

Question: is there a mechanism to prevent cleanup of certain legacy includes or code sections? #121

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

Closed
vonglan opened this issue Sep 29, 2023 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@vonglan
Copy link

vonglan commented Sep 29, 2023

For example with a pseudo-comment / tag

Disclaimer: I am a brand-new user, so I am not yet sure how important such a feature would be

@jmgrassau jmgrassau added the documentation Improvements or additions to documentation label Sep 30, 2023
@jmgrassau
Copy link
Member

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

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau self-assigned this Oct 1, 2023
@jmgrassau
Copy link
Member

Hi Edo,

I now added a section in the documentation for the Main Window:

image

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

@jmgrassau
Copy link
Member

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
Copy link
Author

vonglan commented 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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants