Huawei Cloud CodeArts CheckHuawei Cloud CodeArts Check 插件简介本插件致力于守护开发人员代码质量,成为开发人员的助手和利器。秉承极简、极速、即时看护的理念,提供业界规范(含华为云)的检查、代码风格一键格式化及代码自动修复功能。 注意事项当前有4个需要注意的事项: 1. 插件配置界面需要您这边使用华为云账号信息登录之后,才可以解锁插件配置界面。(注:不会影响插件其他功能的使用) 2. vscode版本要求下载 Visual Studio Code 官网(1.67.0版本以上)并安装,具体请参考安装Vscode,目前只支持windows和linux。 3. 本地安装3.1 打开 VSCode 在左侧导航栏选择“扩展”功能。 4. 自动更新插件会在每次打开vscode的时候,对本地的资源包版本和线上环境里资源包的版本做校验;如果本地资源包版本低于线上最新版本,插件会对资源包进行自动更新。 功能介绍一、检查并查看扫描结果1. 检查1.1 单文件扫描检查在当前打开的文件代码编辑区,点击鼠标右键,选择“CodeArts Check文件检查”: 或者 在项目的资源管理器界面里,鼠标移动到需要扫描的文件,点击鼠标右键,选择“CodeArts Check文件检查”: 1.2 多文件扫描检查在项目的资源管理器里,按住ctrl键,鼠标左键选择需要扫描的几个文件;选择完毕之后,点击鼠标右键,选择“CodeArts Check文件检查”: 1.3 整个项目扫描检查在当前打开的文件代码编辑区,点击鼠标右键,选择“CodeArts Check项目检查”: 或者 在项目的资源管理器界面里,点击鼠标右键,选择“CodeArts Check项目检查”: 1.4 增量扫描检查在当前打开的文件代码编辑区,点击鼠标右键,选择“CodeArts Check增量检查”(前提:当前打开的是标准的git工程): 或者 在项目的资源管理器界面里,点击鼠标右键,选择“CodeArts Check增量检查”(前提:当前打开的是标准的git工程): 2. 查看告警可以按严重级别、规范规则、文件分类查看和告警类型筛选;告警帮助提供告警详细描述、严重级别、告警类型、正确示例、错误示例及修复建议。 2.1 分类查看鼠标移动到检查结果区域,会有四个按钮浮现,点击第一个“分类'按钮,根据需要选择”严重程度/文件分类/规则分类”来进行查看: 2.2 筛选查看鼠标移动到检查结果区域,会有四个按钮浮现,点击第二个“筛选'按钮,根据需要来选择显示问题的方式: 二、一键格式化及自动修复1. 一键格式化支持直接点击一键格式化选项。支持对单文件/多文件/文件夹/整个项目进行一键格式化。 2. 自动修复针对插件扫描出来的单个问题,插件提供建议如何修复的预览界面及自动修复按钮,用户在根据插件的告警指导修改后,我们的插件会自动进行检查,自动更新告警信息,如下gif动图举例,我们在修改了插件的告警提示G.OTH.03之后,插件会自动检查,自动更新告警信息: 三、配置1. 登录查看CodeArts Check配置打开左侧CodeArts Check插件,点击“您尚未登录,请先登录”,使用华为云账号或者AK/SK的方式进行登录,登录成功后点击“CodeArts Check配置”查看配置: 2. 支持手动关闭/开启无感扫描支持无感扫描(扫描完成不影响用户当前作业窗口,修改保存自动扫描、结果自动刷新在问题窗口和CodeArts Check窗口),该功能可以在配置界面手动关闭: 3. 支持配置屏蔽目录和扫描目录支持写相对代码仓的相对目录,例如:一级目录写 目录名,二级目录写 目录1名/目录2名;多个指定目录扫描,可用;号隔开,不填默认扫描整个项目的所有内容(仅在使用“CodeArts Check项目检查”时生效): 4. 支持规则分类检索和快速设置支持规则的搜索或过滤: 支持规则的快速勾选/取消勾选: 5. 支持规则的导入和导出支持规则端对端导入: 支持导出已应用激活的规则:
Introduction of Huawei Cloud CodeArts Check PluginThe 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. Currently, it supports Java, C, C++, Python, and ArkTs. PrecautionsThere are 4 things to look out: 1. Plugin Configuration PageTo configure the plug-in, log in to the plug-in using your Huawei Cloud account. (Note: Other functions of the plug-in can be used without login). 2. Version Requirements Of VscodeDownload the Visual Studio Code official website ((later than 1.67.0) and install it, for details, see vscode installation guide. Currently, only Windows and Linux are supported. 3. Installation3.1 Open Visual Studio Code and click the extension icon from the navigation pane on the left.3.2 Search for "Huawei Cloud CodeArts Check" in the extension marketplace, view details, and install it.3.3 After the installation is successful, the installed plug-in is displayed in the left pane.4. Automatic UpdateThe plug-in verifies both the local and online resource package versions during open the window. If the local version is outdated, the plug-in will automatically update it. 4.1 It handles the download process and keeps users informed about the update's start, progress, and completion.4.2 It remains available when the network is disconnecte.FunctionsSection 1. Checking and viewing results1. Checking1.1 Checking one fileIn 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": 1.2 Checking multiple filesIn the Project window, hold down Ctrl and select multiple files. Then, right-click and click "File Check with CodeArts Check": 1.3 Checking the entire projectIn 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": 1.4 Incremental checkIn the editor area, right-click and click "Incremental Check with CodeArts Check" (Prerequisite: A standard git project is opened): Alternatively, in the Project window, right-click the file and click "Incremental Check with CodeArts Check" (Prerequisite: A standard git project is opened): 2. Viewing defectsViewing defect details, severity, type, compliant example, non-compliant example, and fixing suggestion by severity, rule, file, and defect type. 2.1 Viewing defects by categoryIn the Defects area, click the first button on the left, and viewing defects by severity, rule, and file to view details: 2.2 Filtering defects by defect typeIn the Defects area, click the second button on the left, and filter defects as needed: Section 2. One-Click Formatting and Automatic Fix1. One-click formattingEasily format one file, multiple files, a folder, or an entire project with just one click.
With one-click formatting, you can easily resolve common code specification issues in your project, such as extra spaces or blank lines. 2. Automatic fixThe plug-in provides a preview window with fix suggestions and the automatic fix function: Section 3. Configuring1. Logging to the CodeArts Check plug-inOpen the CodeArts Check plug-in on the left, click "You are not logged in, please log in first", and use a Huawei Cloud account or AK/SK to log in. After the login is successful, click "CodeArts Check Configuration" to view the configuration: 2. Manually turn off/on insensible scanningAutomatic check does not affect the current window. Once you modify and save the code, the latest check results will be automatically updated in the Defects window and the CodeArts Check window. This function can be manually disabled on the configuration page: 3. Scan and exclude directories configurationSpecify 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 with CodeArts Check" is used): 4. Searching for rules by category and setting rulesSearch for or filter rules: Enable or disable rules: 5. Importing and exporting rulesEnd-to-End import rules: Exporting rules that have been applied and activated: |