This blog is the follow-up on the blog How to enable clean code checks for ABAP, which describes how the code pal for ABAP checks can be used in the Code Inspector and ABAP test cockpit to check your code for the adherence to the Clean ABAP style guide.
Now there is a new free and open source version of code pal for ABAP cloud checks, which (as the name already states) is cloud-enabled, thus the checks can now be executed in SAP BTP ABAP Environment. Beyond this all checks are now remote-enabled and can be run in the remote ABAP test cockpit scenario. Additionally, to speed up your code adaptation to Clean ABAP for many findings quick fixes are provided in the ABAP development tools for Eclipse to automate your adjustment tasks.
Let’s take a look at how you can use code pal for ABAP cloud checks in your SAP BTP ABAP environment system to check your code for Clean ABAP.
The code pal for ABAP cloud checks can be executed in SAP BTP ABAP environment.
If you want to check your on-premise releases (or SAP S/4HANA Cloud Private Edition systems) with code pal for ABAP cloud checks you can do it remotely from SAP BTP ABAP environment, see also the blog Usage of ABAP Test Cockpit (ATC) in the cloud for on-premise developments for more details.
It is also possible to set up code pal for ABAP cloud checks in the central ATC check system SAP S/4HANA 2023 Cloud Private Edition or SAP S/4HANA 2023 on-premise using the SAP_BASIS 7.58 extra branch.
You need abapGit to pull the checks from the Git repository into your system. For SAP BTP, ABAP environment systems install abapGit plugin for ABAP development tools for Eclipse.
In the SAP BTP ABAP environment system you will use ABAP development tools for Eclipse and abapGit plugin to install code pal for ABAP cloud checks.
Create a new package in the /CC4A/ namespace, and name it for example CODE_PAL. The source code of code pal for ABAP checks is located in the /CC4A/ (Clean Code for ABAP) namespace, so that collisions with Y*/Z* objects from other projects are avoided.
Open abapGit Repositories View in your ABAP development tools for Eclipse:

Click the „+“ button to link the new abapGit repository:

and enter the path to the GitHub repository https://github.com/SAP/code-pal-for-abap-cloud, containing the code pal for ABAP cloud checks:

In the next step enter the name of your newly created package /CC4A/CODE_PAL and check the Pull after link checkbox:

Finally, after completing the abapGit plugin wizard, the code pal for ABAP cloud checks repository will be linked:

and the source code of the check implementations pulled under your newly created package /CC4A/CODE_PAL:

Just activate all objects, and the code pal for ABAP cloud checks are ready to use.
The check variant /CC4A/CODE_PAL_FULL contains all available code pal for ABAP cloud checks:

There is also the package /CC4A/CODE_PAL_TEST_OBJECTS, which you can use to see how the code pal for ABAP cloud checks work. Just select this package and use the context menu Run ABAP Test Cockpit With…

Enter the ATC check variant /CC4A/CODE_PAL_FULL and click the OK button to execute the ATC run:

The ATC Problems View provides the check results concerning violations of the Clean ABAP rules in the source code objects of the test package:

Now you can select your own development package(s) or set(s) of the development objects which you want to check and execute the code pal for ABAP cloud checks over these objects.
If you take a look at the ATC results, the yellow bulb icons before the ATC findings indicate that for these ATC findings the quick fixes in ABAP development tools for Eclipse are available, which allow to fix these findings in an automated way.

By navigating from an ATC finding to the corresponding source code line you can see the examples of the violations of the Clean ABAP rules and can try out the corrections, which are provided by quick fixes using the Ctrl + 1 shortcut.
In the following example the code pal for ABAP cloud check detects the unnecessary self reference, which can be removed via the quick fix:

In the next example the check finds a chain declaration, which can be replaced with separate declarations of the variables involved using the quick fix:

In the last example the values are allocated more than once within one statement and the quick fix will break the assignment chain into multiple statements:

You can also use mass-enabled quick fixes (context menu Recommended Quick Fixes will start the wizard) to adapt all ATC findings at once:

Further information on code pal for ABAP cloud checks, including how to contribute to this open source project, provide feedback or get support, is provided on the GitHub under https://github.com/SAP/code-pal-for-abap-cloud/. Use "Watch" button to get notified about changes (you get it if you log in to GitHub).
The check migration list shows the current migration status of checks from the legacy version.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 49 | |
| 46 | |
| 34 | |
| 32 | |
| 30 | |
| 29 | |
| 28 | |
| 24 | |
| 23 | |
| 22 |