The Open Source contribution Clean ABAP style guide for ABAP coding offers best practices and set of rules for you as developers to enable you to write more efficient, easier to understand and maintainable code. Having a common understanding of the code style enhances consistency of the code base and thus significantly improves your developer experience enforcing to work more quickly with even unfamiliar code and speed up the ramp up of new developers in your environment.
The style guide allows to enforce rules with static code checks. Based on the Clean ABAP, the free and Open Source code pal for ABAP tool contains a set of checks to support the Clean ABAP adherence. Code pal for ABAP checks can be used in Code Inspector and ABAP Test Cockpit.
Install code pal for ABAP via abapGit
In order to install code pal for ABAP you need to pull the Git repository using abapGit. If you don’t have abapGIT in your system then just install standalone abapGIT version.
Start abapGIT
Enter the link to the code pal Git repository
https://github.com/SAP/code-pal-for-abap.git along with a package name e.g. ZCODE_PAL_FOR_ABAP. This package will be created automatically when pulling from the Git repository. Alternatively, you can select Create Package to create the package manually with your own settings. Use Folder Logic Prefix and enter Display Name e.g. code-pal-for-abap. Select Create Online Repo.
Select Pull to copy all objects from the Git repository into your SAP system:
Configure code pal for ABAP checks
Start Code Inspector (transaction SCI) and activate code pal for ABAP by using the menu Code Inspector->Management of->Checks
and by selecting all code pal for ABAP checks and clicking the Save button:
After that create a new global check variant, e.g. ZCLEAN_ABAP. Select the code pal for ABAP checks group and save it:
You can also use the „Attributes“ button
to configure the applicability of a check for example according to the object‘s creation date or severity of an ATC message:
For advanced users: You can also use the code pal
profile management tool to configure the code pal checks behavior for your individual needs (e.g. check filter on object creation date, validity period etc.). But please be aware, that if you assign a profile to your user, it will overwrite the Code Inspector variant.
Execute clean code ABAP checks
Congratulations! Now you are able to execute your clean ABAP (abap code pal) checks over your code. Just select the package in your project in the ADT in Eclipse (ZCLEAN_ABAP_DEMO in our example), use the context menu Run As -> ABAP Test Cockpit With…
and choose ZCLEAN_ABAP as a check variant:
The result list with the ATC findings from clean code checks will be displayed in the ATC Problems View and you can navigate to the details of each finding and process the list to fix the issues in order to make your code adherent to Clean ABAP.
No comments:
Post a Comment