Skip to content

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

Closed

Description

@vonglan

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

Activity

  1. jmgrassau commented on Sep 30, 2023

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

  2. self-assigned this
    on Oct 1, 2023
  3. jmgrassau commented on Oct 1, 2023

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

  4. jmgrassau commented on Oct 2, 2023

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

  5. vonglan commented on Oct 4, 2023

    @vonglan
    Author

    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

  6. jmgrassau commented on Oct 5, 2023

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

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions