ABAP cleaner executes 60+ cleanup rules on your ABAP code at a single keystroke – while giving you and your team full control over the selection and configuration of these rules. It was published in April 2023 as an Open-Source project with the ambition “to automate whatever can be automated” with respect to ABAP code style.
Join this session to see what ABAP cleaner offers, how it is installed, used and configured, and how it relates to other Open-Source projects like Code pal for ABAP and the Clean ABAP style guide.
Link to the presentation used in the session : https://dam.sap.com/mac/u/a/yPnDZ6e.htm?rc=10
After watching the session, be sure to complete the validation tutorial to earn points for Devtoberfest! https://developers.sap.com/tutorials/devtoberfest2023-week2-abap-cap-abapcleaner.html
Speaker : Joerg-Michael Grassau, SAP
An excellent session that enlightened us about ABAP Cleaner, shedding light on its functionality and how it operates. This tool proves highly beneficial for enhancing productivity and refining technical documentation. Great job!
Impressive thorough work put into this tool (and into the presentation).
Maybe I shouldn’t comment on this without actual experience using the tool, but these are my initial thoughts.
Some of the rules will really make code more readable.
Other of the rules seems more religious and will not really add value.
A few of the rules will make it more difficult to extend the code later. For example, I think the rule “Remove long IF blocks at method end” and “Use Final for immutable variables” could end up being contra-productive.
Thanks very much for the feedback! This underlines quite well why it makes sense to keep the tool configurable, because every situation is a bit different (new code / legacy code, requirements to downport, team preferences etc.).
Regarding "religious" cleanup rules :-), even those could make the code more readable if they make its syntax and appearance more consistent; but nobody will be offended if you deactivate such rules!
"Remove long IF blocks at method end" might depend on configuration ("Replace IF blocks with at least ### lines"). There are legacy code methods out there with IF blocks spanning hundreds of code lines… on the other hand, the cleanup rule somewhat goes against the principles of structured programming (which demands a method to have exactly one entry point and one exit point).
"Use FINAL for immutable variables" is actually deactivated by default, because this keyword is rather new to ABAP, so it may only make sense on new code that does not need to be downported. Since this is always only local (inside of a method), it would be easy to change if the respective method needs to be enhanced later. And the rule has a careful approach, so, whenever a reference is created to a variable (which could be passed on to another method etc.), FINAL will not be introduced (see the examples of this rule).
Anyway, thanks for your thoughts, and as you can see on the issues in the ABAP cleaner repository, new suggestions always come with some discussion until good defaults and configuration options are found to address the various needs!
Very nice tool.
But why is CONTINUE considered clean ABAP? Like CHECK (and sometimes RETURN if not used as exception handling) it is a glorified GOTO statement. Over time I had run into so many bugs that were somehow caused by lack of readability because of those statements. Worst was maybe an infinite loop in DO. ... ENDDO with many EXIT statements inside. Maybe it is more pleasing the eye, but in reality, the same conditional logic is used that is now hidden. Indented IF statements show what it really is. And if too much clutter: simply break up the methods into smaller logical pieces.
Well I do not agree that a lot of spaghetti if statements are better than CONTINUE, CHECK and RETURN.
But abap editors could be improved. When we double click on one of the above statements, It would be great help if the cursor would actually jump ( GOTO 🙂 ) whatever statement will be next in the process.
I know this suggestion has nothing to do with clean code, but the purpose is kind of the same. It should be easier to read and navigate existing code.
It may be that you are behind a corporate firewall and there is an SSL problem (because your company inserts its own certificates into the chain). I cannot really tell because you don't have the complete log there.
In this case (and if you are on Windows), follow the instructions here: java - Importing SSL Certificate into Eclipse - Stack Overflow