Updated on 2024-10-10 GMT+08:00

Configuring a Preset Rule Set

A rule set is a set of rules used for code checks, with variations within different sets. These sets are classified based on different objectives, such as security, Android apps, and coding styles.

You can modify the rule sets as needed, and the updated rules will be applied during the next check.

CodeArts Check supports rule sets in multiple languages at different levels. For details about system rule sets, see Table 1.

Rule sets of multiple languages cannot be used to check a task at the same time. Example: C# rule sets cannot be applied with other language rule sets to check a task.

Table 1 Preset rule sets

Language

System Rule Set

Default Rule Set

Extension of Supported File

C++

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.c/.cc/.cpp/.cxx/.cp/.c++/.inc/.inl/.mm/.h/.hh/.hpp/.hxx/.h++

Java

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.java

Go

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.go

Python

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.py

JavaScript

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.js/.jsx

C#

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.cs

TypeScript

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.ts/.tsx

CSS

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.css

HTML

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.html

PHP

  • Generic Inspection Rule Set

Generic Inspection Rule Set

.php

LUA

General Criterion Set

General Criterion Set

.lua

RUST

General Criterion Set

General Criterion Set

.rs

Shell

General Criterion Set

General Criterion Set

.sh

KOTLIN

General Criterion Set

General Criterion Set

.kt

/

detektout

Viewing Rule Details in a Rule Set

View the rule details in rules sets, such as issue levels, compliant and non-compliant examples, and fix suggestions, to select a desired rule set.

  1. Access CodeArts Check through a project.
  2. Click the Rule Sets tab.
  3. Click the rule set name to go to the details page.

    Alternatively, click Export to export the enabled rules in the rule set to the local PC and view the rule details.

Modifying the Default Rule Set

Each language has its default set, as shown in Table 1. Perform the following operations to modify the default rule set if needed.

To view the default rule sets, access CodeArts Check through a project.

  1. On the Rule Sets tab page, filter the target language in the Language column.
  2. Click in the row where the rule set locates and select Default Set to set the current rule set as default.

Configuring the Rule Set to Be Used

Perform the following operations to use other preset rule sets. Alternatively, customize rule sets if needed. For details, see Configuring a Custom Rule Set.

  1. Go to the task page. In the task list, click a task name.
  2. On the task details page, choose Settings > Rule Sets.
  3. In the Languages Included area, enable the switch of target language.
  4. In the Enable Rule Set area, click to select the rule set to be used.

    (Optional) To configure extended parameters for the selected rule set, click Parameter, configure extended parameters, enable the configuration function, and click OK.

    To use a code security enhanced package, you need to configure check parameters.