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.
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, choose on the navigation bar, click the Config Center tab, click Advanced, and toggle on the switch of Display Engine.
Note: This function requires the tenant permission or the te_admin role in IAM 3.0.Figure 1 Switch of display 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 2 Viewing rules in a rule set
- Offline viewing: Choose
> Export to export enabled rules from the rule set to your local PC.
- Online viewing:
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.
Preset Rule Sets
|
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 |
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