# xts-code-check **Repository Path**: yjzwk/xts-code-check ## Basic Information - **Project Name**: xts-code-check - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-31 - **Last Updated**: 2026-09-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Usage 0. 用于本地测试,请使用最新master版本 1. 将需要扫描的文件放在`xtscheck/testcase`下(其他路径则需手动更改示例命令中<测试文件根目录>的值) 2. 在`xtscheck`目录下,编写`list.json`,指定要扫描的文件(file_path为相对于<测试文件根目录>的路径),如: ```json [ { "file_name": "AllTimeTrue.test.ets", "file_path": "AllTimeTrue.test.ets" }, { "file_name": "build-profile.json5", "file_path": "build-profile.json5" }, { "file_name": "Test.json", "file_path": "Test.json" }, { "file_name": "CertResolution.test.ets", "file_path": "CertResolution.test.ets" }, { "file_name": "HiAppEventCPPTest.cpp", "file_path": "HiAppEventCPPTest.cpp" }, { "file_name": "BUILD.gn", "file_path": "BUILD.gn" }, { "file_name": "BUILD.gn", "file_path": "acts/BUILD.gn" } ] ``` 上述配置对应的目录结构为: ```bash xtscheck/testcase ├── AllTimeTrue.test.ets ├── BUILD.gn ├── CertResolution.test.ets ├── HiAppEventCPPTest.cpp ├── Test.json ├── acts │   └── BUILD.gn └── build-profile.json5 1 directory, 7 files ``` 3. 在**Linux环境**下,进入项目根目录,执行检查: ```bash ./run_check.sh ``` 4. 测试结果输出在`xtscheck/log`目录中,其中: - `xts_result.jsonl`: 该文件为XTS CodeCheck结果,**如果检查出问题,将输出到该文件**,检查全部通过则该文件内容为空 - `xtscheck.log`: 该文件为全量日志,用作调试,可基于该文件分析CodeCheck过程中的额外输出信息 5. 指定输出路径及执行规则: ```bash # ./run_check.sh <日志输出路径> <规则id, 多id以@分割> <报告文件路径> <扫描目标文件配置(即list.json)> <测试文件根目录> # Example: ./run_check.sh /home/ubuntu/workspace/xts-code-check/log \ XTS.CHECK.ASSERTION.01@XTS.CHECK.OHOS.DEVICEINFO.DEVICETYPE.01 \ /home/ubuntu/workspace/xts-code-check/log/xts_result.jsonl \ /home/ubuntu/workspace/xts-code-check/xtscheck/list.json \ /home/ubuntu/workspace/xts-code-check/xtscheck/testcase ``` 6. 使用jar执行全量命令(服务端集成): ```bash java -jar "/home/ubuntu/workspace/xts-code-check/XtsCheck-1.0.0.jar" \ --output /home/ubuntu/workspace/xts-code-check/log/ \ --checker XTS.ALL.RULE \ --project_root /home/ubuntu/workspace/xts-code-check \ --param_file_path /home/ubuntu/workspace/xts-code-check/xtscheck/list.json \ --source /home/ubuntu/workspace/xts-code-check/lib/xts-code-check/xtscheck/testcase/ ```