Using CodeArts Check Plug-in in IntelliJ IDEA
This plug-in is a powerful assistant for developers to protect the code quality. It provides industry standard check, one-click code style formatting, and automatic code fixing, adhering to the concepts of simplicity, high speed, and real-time monitoring.
Installing the Plug-in
- On the IntelliJ IDEA editor, choose on the top menu bar.
- Click Plugins in the navigation pane on the left and click Marketplace in the right pane.
- Enter Huawei Cloud CodeArts Check or CodeArts Check in the search box.
- Click Install. Then IntelliJ IDEA restarts. After the restart, IntelliJ IDEA automatically downloads the engine package and the JDK package.
- Once the download is finished, a message appears in the lower right corner confirming the successful download.
Configuring the Plug-in
- Click CodeArts Check at the bottom of the IntelliJ IDEA editor and click Setting on the toolbar.
- In the displayed window, click on the left to view the rule details.
- Decide whether to enable automatic code check, enter the masked directory, and specify directory to be checked.
- See the activated or applied rule details (including status, level, language, engine tag, and rule type) or filter rules by all/recommended rule set.
- After the configuration, click Apply.
Checking and Fixing Files by the Plug-in
Take a local Java project as an example.
The CodeArts Check plug-in allows you to check one or multiple Java files, as well as the entire project. You can also correct code style issues with just one click. For details, see Plug-in Functions, One-Click Formatting and Automatic Fix, and Rule Configuration.
Plug-in Functions
- Checking one or multiple files, as well as the entire project, and viewing the results.
- Checking one file: In the editor area, right-click and click File Check with CodeArts Check. Alternatively, in the Project window, right-click the file to be checked and click File Check with CodeArts Check.
- Checking multiple files: In the Project window, hold down Ctrl and select multiple files. Then, right-click and click File Check with CodeArts Check.
- Checking the entire project: In the editor area, right-click and click Project Check with CodeArts Check. Alternatively, in the Project window, right-click the file and click Project Check with CodeArts Check.
- Checking one file: In the editor area, right-click and click File Check with CodeArts Check. Alternatively, in the Project window, right-click the file to be checked and click File Check with CodeArts Check.
- Viewing defect details, severity, type, compliant example, non-compliant example, and fixing suggestion. Filtering defects by severity, rule, and file.
- Viewing defects by file: Open the CodeArts Check window, click Defects > > View By File.
- Viewing defects by severity: Open the CodeArts Check window, click Defects > , and select a defect type as required.
- Triggering automatic check and defect update.
The plug-in automatically checks code in real time and updates defects after you fix the code defects based on fixing suggestions.
- Viewing defects by file: Open the CodeArts Check window, click Defects > > View By File.
One-Click Formatting and Automatic Fix
-
One-click formatting on a single file, multiple files, a folder, or an entire project.
With one-click formatting, you can easily resolve common code specification issues in your project, such as extra spaces or blank lines.
In the editor area, right-click and click Auto Format with CodeArts Check. Alternatively, in the Project window, right-click the file and click Auto Format with CodeArts Check.
-
Automatic fix for a single defect checked by the plug-in.
The plug-in provides a preview window with suggestions on how to fix and the automatic fix function.
Rule Configuration
Open the CodeArts Check window, click Setting.
No. |
Configuration |
Description |
---|---|---|
1 |
Automatic code check after editing and before commit |
|
2 |
Check mode |
The local mode is used by default. |
3 |
Excluded directory |
Specify multiple directories by separating them with commas (,). To check the dir1 directory, enter dir1. To check dir2 in the dir1 directory, enter dir1/dir2. If no directory is specified, all content of the entire project is checked by default. This parameter is valid only during project check. |
4 |
Search by category |
Search for or filter rules. |
5 |
Setting rule |
Select or deselect rules. |
6 |
Uploading/Exporting rule |
Export the rule details to an XLSX file on the local PC. Upload the rule file in XLSX format prepared on the local PC. |
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