Check your Cloud Integration naming conventions with CPILint 1.0.4
Version 1.0.4 of CPILint is out and you can get your free copy over on GitHub. What is CPILInt, you ask? CPILint is an open source, command-line tool for SAP Cloud Integration that lets you automate the governance of your integration flows. You do so by choosing rules that you want your iflows to adhere to. The tool then does the heavy lifting of checking your iflows for compliance. CPILint ships with rules covering best practices, security, scripting, connectivity and more. For a lengthier introduction to CPILint, please see this blog post.
The NamingConventions rule is finally here
The main feature of the new release is the NamingConventions rule, which lets you check that your naming conventions for channels, flow steps etc. are being followed. This is the number one most requested CPILint feature, and I’m really happy to finally release it! Let’s jump right in and take a look at some examples.
SAP’s Integration Flow Design Guidelines suggest a number of different naming conventions. One of them states that all HTTP receiver channel names must start with
HTTP_RCV_. This is what that naming convention looks like using CPILint’s new NamingConventions rule:
<naming> <scheme> <starts-with>HTTP_RCV_</starts-with> </scheme> <message>HTTP receiver channel names must start with HTTP_RCV_</message> <apply-to>http-receiver-channel.name</apply-to> </naming>
Straightforward, right? Add this to your rules file, and CPILint will check all your HTTP receiver channels and verify that their names are compliant.
A NamingConventions rule consists of three things:
- A naming scheme (i.e. the naming convention that must be followed)
- The error message that will be displayed, if the naming convention is not followed
- Which names to check
The same naming rule can be applied to multiple names, and the
<apply-to> element can therefore occur more than once. At the moment, there are 55 different names you can check, but not all flow step names are supported yet, for instance. Even more names will be added in future versions of CPILint.
Here’s a slightly more complex example. SAP’s guidelines also state that the names of all participants (that is, senders and receivers) must start with
CP_ (for on-premise systems, business partners and cloud providers, respectively). Here’s how to implement that naming convention in CPILint:
<naming> <scheme> <or> <starts-with>OP_</starts-with> <starts-with>B2B_</starts-with> <starts-with>CP_</starts-with> </or> </scheme> <message>Participant names must start with OP_, B2B_ or CP_</message> <apply-to>sender.name</apply-to> <apply-to>receiver.name</apply-to> </naming>
My last example uses the regular expression naming scheme to make sure that Message Mapping steps don’t use the default name:
<naming> <scheme> <not> <regex>Message Mapping \d+</regex> </not> </scheme> <message>Don't use the default Message Mapping step names</message> <apply-to>message-mapping.name</apply-to> </naming>
For the details of the supported naming schemes and a list of all the names you can check using the NamingConventions rule, please see the CPILint wiki.
Other bits and pieces
CPILint now automatically checks whether you are running the latest version of the tool. When a new version is released, you will be notified that there is an upgrade available.
Previous versions of CPILint did some validation of the rules file, but from version 1.0.4 and onwards, the rules file XML document is properly validated using an XML Schema.
-tmn-host command-line option, which you use to point the tool at your Cloud Integration tenant, is now simply called
-host. If you run CPILint from a script, please make sure to update it accordingly.
There was, unfortunately, a bug in the DuplicateResourcesNotAllowed rule. It would crash the tool at the end of a session if no iflows had been inspected. This has been fixed in version 1.0.4.
To get you started, CPILint now also ships with two sample rules files. You can find them in the
samples directory in the root of the installation.
The CPILint project by the numbers
This is the fifth release of CPILint so far. There has been 55 commits to the GitHub repository since the initial commit of version 1.0.0 back in September, 2019. As of version 1.0.4, the tool’s code consists of 116 Java source files containing a total of 4513 lines of code (not counting comments). There are a couple hundred more lines of code in there, most of them XQuery, XML Schema and XSLT.
That’s it for version 1.0.4 of CPILint. I’m really looking forward to hearing your feedback, especially about the NamingConventions rule! So please give the new version a download, and feel free to share your thoughts in the comments below.