Skip to content

Question: Clean-Up Interactive Mode without changing the class? #114

Closed

Description

@ZEAL-IT

Hello,
while I introduced this great functionality to some colleagues, I noticed that even when trying to jump into interactive mode I'm already changing the class, therefore I must be added to the transport request. We want to use the cleaner in Code Reviews, so I would like to see how much the cleaner finds, but in a "read only" mode if that makes sense?
What do you think?

Activity

  1. jelliottp commented on Sep 26, 2023

    @jelliottp

    This is a good idea. I've often wanted to do something similar, to check whether another developer has run the cleanup.

  2. jmgrassau commented on Sep 26, 2023

    @jmgrassau
    Member

    Hi ZEAL-IT and Josh,

    that's indeed a good point – ABAP cleaner starts a "rewrite session" when opening the interactive cleanup, which prevents other people from changing the object in the meantime.

    A "read only" mode would also be beneficial when looking at legacy code (or any code in non-development systems) which you can't or won't change at that moment: With the cleanup rules applied, the code might simply be easier to read and understand.

    So, yes, very nice idea – I'd only hesitate a bit about adding another menu item (and shortcut?) for it.

    For the time being, a quick workaround would be to install the stand-alone version in parallel: You can paste any amount of ABAP code into that just via clipboard, as long as blocks like IF ... ENDIF are complete (see usage). Both the stand-alone version and the ADT plug-in share the same profile settings etc., which are saved on the local machine.

    Kind regards,
    Jörg-Michael

  3. ZEAL-IT commented on Sep 26, 2023

    @ZEAL-IT
    Author

    This is a good idea. I've often wanted to do something similar, to check whether another developer has run the cleanup.

    That would be a cool feature too. The code pal would insert a line at the beginning with a checksum or something and an ATC check can check if the comment exists and the checksum is correct

  4. ZEAL-IT commented on Sep 26, 2023

    @ZEAL-IT
    Author

    Hi ZEAL-IT and Josh,

    that's indeed a good point – ABAP cleaner starts a "rewrite session" when opening the interactive cleanup, which prevents other people from changing the object in the meantime.

    A "read only" mode would also be beneficial when looking at legacy code (or any code in non-development systems) which you can't or won't change at that moment: With the cleanup rules applied, the code might simply be easier to read and understand.

    So, yes, very nice idea – I'd only hesitate a bit about adding another menu item (and shortcut?) for it.

    For the time being, a quick workaround would be to install the stand-alone version in parallel: You can paste any amount of ABAP code into that just via clipboard, as long as blocks like IF ... ENDIF are complete (see usage). Both the stand-alone version and the ADT plug-in share the same profile settings etc., which are saved on the local machine.

    Kind regards, Jörg-Michael

    Haven't thought of the standalone version, thank you! I guess you can't tell if the class is already locked (in that case the edit mode would be fine) or if the class is in read only mode (which it is in Eclipse until you change something)

  5. vonglan commented on Sep 29, 2023

    @vonglan

    +1 (to the general idea of a read-only, not locking mode)

  6. self-assigned this
    on Oct 1, 2023
  7. jmgrassau commented on Oct 1, 2023

    @jmgrassau
    Member

    Hi ZEAL-IT, Josh and Edo,

    with the next ABAP cleaner release, there will now be a third menu item (hope the menu text + shortcut are intuitive?)

    image

    This opens the interactive window without locking the object, so you can also call it if someone else locked the object, or you don't have a transport, or you're in the wrong client, or you don't even have development authorization in the system.

    Inside the ABAP cleaner UI, everything is exactly the same, except that you don't have the "Apply and Close" button and menu, but instead, you only have

    image
    and
    image

    So whatever you do inside the ABAP cleaner UI, the code in the ADT editor will not be affected. You can nevertheless change ABAP cleaner configuration (selected profile, restriction to ABAP release, activation of rules, rule options etc.) just as you would in the interactive cleanup, and these changes are kept.

    Another small improvement is that the window title now also shows the ABAP release of the system in which the code editor was opened:

    image

    Kind regards,
    Jörg-Michael

  8. jmgrassau commented on Oct 1, 2023

    @jmgrassau
    Member

    P.S.: If you have better suggestions for "Preview as Read-Only With ABAP Cleaner…", please let me know. "Show Read-Only Preview of Cleanup With ABAP Cleaner…" would be more precise, but that would be a bit long. I also considered "Preview (Read-Only) With ABAP Cleaner…", but the parentheses look a bit awkward in the menu.

    Regarding the shortcut, Ctrl+5 would probably also be available, but since this opens the UI, I felt that it is better to have a shortcut that is similar to Ctrl+Shift+4. Anyway, everybody could configure this as needed – and I know, on certain macOS releases, both Ctrl+Shift+4 and Ctrl+Shift+5 are reserved by the system for screenshot(?) functionality.

  9. ZEAL-IT commented on Oct 2, 2023

    @ZEAL-IT
    Author

    Hi Jörg-Michael,
    that is awesome, thank you! For the text I think just "Preview with ABAP Cleaner" is enough, but yours works too for sure. I agree with the shortcut, it should be Ctrl+Shift and the 5 just makes sense

  10. jmgrassau commented on Oct 2, 2023

    @jmgrassau
    Member

    Hi ZEAL-IT,

    thanks a lot! I actually changed the menu text again to "Show Read-Only Preview With ABAP Cleaner…", because I felt "Preview as Read-Only" sounded a bit awkward (but I'm obviously not a native speaker).

    Anyway, I somehow wanted to have "Read-Only" in the text in order to point out the difference to the interactive cleanup – which could of course also be used as a preview, if you close it with "Cancel".

    Release process is on its way now, so this will be available very soon :-)

    Kind regards,
    Jörg-Michael

  11. jmgrassau commented on Oct 2, 2023

    @jmgrassau
    Member

    Hi ZEAL-IT,

    thanks again for this great idea! This is now available with version 1.6.0, which was just released!

    Kind regards,
    Jörg-Michael

  12. JoachimRees commented on Oct 4, 2023

    @JoachimRees

    This all makes a lot of sense, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions