Configuring a Preset Rule Set
A rule set is a collection of rules for checking code. Rule sets are categorized based on their targets, including security, Android apps, programming styles, and coding standards.
You can modify the rule sets as needed, and the updated rules will be applied during the next check.
Modifying the Default Rule Set
Configuring the Rule Set to Be Used
Constraints
- 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.
- Preset rule sets are uneditable, while custom rule sets can be edited. If needed, you can create custom rule sets based on preset ones by referring to Customizing a Rule Set.
Viewing Preset Rule Sets
- CodeArts Check supports rule sets in multiple languages at different levels. For details about system rule sets, see Table 1.
- 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.
- Access CodeArts Check.
- Click the Rule Sets tab.
By default, the check engine used by the rule is not displayed. To view the check engine, see Displaying the Check Engine.
You can sort rule sets by Rules or Modified. The two sorting criteria are exclusive. For example, if rules are sorted by Modified, the sorting by Rules becomes invalid.
- Click the rule set name to go to the details page and view the rule usage details.
- Online viewing: Figure 1 Viewing rules in a rule set
- Offline viewing: Choose
> Export to export enabled rules from the rule set to your local PC.
- Online viewing:
Copying a Preset Rule Set
On the rule set list page, click
next to a rule set to copy it. Copied rule sets are custom rule sets. For the constraints, see Constraints.
Viewing Tasks Using a Rule Set
- On the rule set list page, click a rule set name. The rule set details page is displayed.
- Choose
> Task Usage to view the tasks using the rule set.
When you view how many tasks are using a rule set, if the task count exceeds 10,000 and fluctuates, the count updates with a one-hour delay. However, on first view, there is no delay.
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.
- On the Rule Sets tab page, filter the target language in the Language column.
- 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.
- Go to the task page. In the task list, click a task name.
- On the task details page, choose Settings > Rule Sets.
- In the Languages Included area, enable the switch of target language.
- In the Enable Rule Set area, click
to select the rule set to be used. To configure extended parameters for the selected rule set, click Parameter, configure extended parameters, enable the configuration function, and click Confirm.
Configuration parameter description
You can configure compilation parameters for only one language at a time. To change to another language, disable the current language first.
Compiler Tools Options: This option is disabled by default. You need to toggle it on to enable the strict compilation mode.
Strict Compile Mode: If this mode is enabled, code compilation failures will cause task failures. If this mode is disabled, code compilation failures do not affect task results. Note: Only the SecBrella engine is supported, and this engine supports only version-level full check.
Build Tool: The corresponding compilation image is matched during the task execution. When you select a compilation tool, the default version and command are auto-filled. You can manually modify the parameters if necessary. When using the Go compiler, ensure proper retrieval of dependency packages for a successful build. To adjust the GOPROXY environment variables, use go env -w in your compile script.
buildToolVersion: Select the compilation tool version supported by the extended parameters from the drop-down list.
compileScriptCmd: The corresponding compilation command is automatically obtained after you select a compilation tool.
Preset Rule Sets
CodeArts Check has compilation tools for supported languages.
| Language | System Rule Set | Default Rule Set | Extension of Supported File |
|---|---|---|---|
| C++ |
| Huawei C/C++ Codestyle Specification Criterion Set | .c/.cc/.cpp/.cxx/.cp/.c++/.inc/.inl/.mm/.h/.hh/.hpp/.hxx/.h++ |
| Java |
| Huawei Java Coding Standard Rule Set | .java |
| Go |
| Huawei Codestyle Specification Criterion Set | .go |
| Python |
| Huawei Codestyle Specification Criterion Set | .py |
| JavaScript |
| Huawei Js Coding Standard Rule Set | .js/.jsx |
| C# |
| General Criterion Set | .cs |
| TypeScript |
| General Criterion Set | .ts/.tsx |
| CSS |
| General Criterion Set | .css |
| HTML |
| General Criterion Set | .html |
| PHP |
| General Criterion 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 |
| Terraform | General Criterion Set | General Criterion Set | .tf |
Related Documents
- For APIs about rule sets, see Rule Management.
- For details about the best practices of using preset rule sets, see Checking Code from Git with Preset Rules.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot