Ruleset configuration

The Welkin Suite gives you an ability to configure the necessary rulesets in a handy and clear way. The IDE provides you with a ruleset configurator, which presents the information about all the available PMD Apex rules in a friendly manner, allowing you to select which rules you would like to use in the ruleset, and which parameters each rule should have.

To get an access to the Ruleset Configurator, navigate to the Main Menu: Tools ⇒ PMD Apex Ruleset Configuration.

Run PMD Ru;eset Configuration from the Main Menu

You will get an opened empty window, where you can manage all the rulesets for checking your code before the build process.

To create a new ruleset, press the New button and select one of the options: create an empty ruleset or create from a template.

Create a new ruleset

Creating from an empty ruleset

When you select an option to create a new empty ruleset, using the way: New ⇒ New Empty Ruleset, you'll get a list of all the available PMD Apex rules. At the first step, you need to enter a name and description for a new ruleset on the Ruleset Properties tab, these fields are required. Also, you can specify files, that needs to be excluded from the scanning list, or backward – obviously included.

Creating from an empty ruleset

Below the ruleset properties, you can find a list of the PMD rules combined into categories. Next to the category name, there is a number of enabled rules with a total number of rules in a category. Expand a category to see the rules it includes. Click on a necessary rule, you will get the information about it in the right part of the PMD Apex Ruleset Configuration. The extended information includes the following:

  • name of a PMD rule;
  • PMD class that realize the rule;
  • description of a PMD rule with a condition when it will be executed;
  • link to the related documentation;
  • list of rule's parameters.

Rule properties

The parameters for a PMD rule are combined into the following categories:

  • Attributes — priority of a rule and a message for it.
NB: Priority recognizes if the disparency to a rule is a warning or an error, should it block your further work to draw your attention to some piece of code and this is critical or you can continue your working process and make changes later.

PMD priority for a rule can be the next:

  • 1 – change is absolutely required,
  • 2 – change is highly recommended,
  • 3 – change is recommended,
  • 4 – change is optional,
  • 5 – change is highly optional.
  • General — the settings for configuration each rule,
  • Code Climate — this set of parameters will be useful for you if you use Code Climate application.

Above the list of rules, you can find a filter, that will help you to find a necessary one in a few seconds. Just start typing, and the list will be shortened to fit your request.

Set all the necessary values in the appropriate fields and click the Save button at the top of the window.

You can always revert all your changes in any ruleset: click on the Reset rule settings button at the top of the window.

Creating from a template

As another option of creating a ruleset for PMD, The Welkin Suite offers two built-in templates:

  • Code Climate Template — the default ruleset used by the Code Climate Engine,
  • The Welkin Suite Template — a ruleset, developed by The Welkin Suite's team.

To create a ruleset from a template, follow the way: New ⇒ New From Template and select an appropriate template.

The Welkin Suite template for a new ruleset

Modify all necessary fields and click the Save button.

In addition, you can also custom XPath rules to your rulesets directly from the IDE. With the custom rules support you will be able to precisely craft your own ruleset according to your personal or team preferences and policies regarding code quality. To do so, click the Add rule button.

Сustom XPath rules

Loading an existing ruleset

If you've already created a ruleset and you want to modify it, click on the Open button. In the opened window, select a folder, where the ruleset's file is located, select the file, and click the Open button. Your ruleset will be loaded to the PMD Apex Ruleset Configurator, and you'll be able to change it as you want.

In this section:

This also may be useful:

Last modified: 2018/03/14 10:15

footer image