Code Quality On Projects
Code quality of a configuration is supported by multiple tools: IntelliJ IDEA, Gitlab and SonarQube. All of these tools are internally using CodeNarc which is a standard tool for static analysis for Groovy language. CodeNarc provides more than 400 rules that can be used for quality check. We reviewed each rule and determined which ones should be enabled or disabled. As a result, we formulated a standardized ruleset for each of the tools.
IntelliJ IDEA
IntelliJ IDEA is used by Configuration Engineers during development. CodeNarc setup and usage in Studio are described at Code Quality in IDEA.
Pfxprobe
We developed a tool called “pfxprobe” designed to be executed as a Gitlab (or other) pipeline, facilitating the evaluation of merge request quality. Internally, we employ pfxprobe in our projects, primarily enabling Solution Architects to gain insights into the delivered code quality. Naturally, the configuration team may also find this tool beneficial.
Setup for a project is easy: generate pom.xml and .gitlab-ci.yml files in Studio project by right-clicking the root folder in Studio > Pricefx > Create pom.xml and .gitlab-ci.yml and commit these files to the repo.
The tool is available as docker image pricefx/pfxprobe at the Docker Hub and can be used for a setup at a customer’s Gitlab instance (or other CI/CD service). You can check the Gitlab pipeline configuration in the ‘pfxprobe’ section of our standard .gitlab-ci.yml file.
SonarQube
To provide an overview of the project's code quality for Solution Architects, Configuration Engineers and management, we use SonarQube internally. It is executed as Gitlab pipeline and the setup is the same as for pfxprobe.
Generate pom.xml and .gitlab-ci.yml files in Studio project by right-clicking the root folder in Studio > Pricefx > Create pom.xml and .gitlab-ci.yml and commit these files to the repo.
If the customer or partner run their own SonarQube instance, the standard ruleset for Pricefx configurations can be downloaded from: https://developer.pricefx.eu/studio/codenarc/Sonar_Pricefx_Configuration.xml
To see how SonarQube is set up in our pipeline, see the ‘sonarqube’ section of our standard .gitlab-ci.yml file.
Found an issue in documentation? Write to us.