R006: 禁止基于设备类型差异化
OfficialPrevent device-type branching that breaks XTS.
Software Engineering#code quality#static analysis#conditional logic#ArkTS#device compatibility#xTS testing#capability checks
Authoropenharmonyinsight
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This rule helps you avoid using device type conditions (like deviceInfo.deviceType) in test logic, which can cause XTS cases to fail or behave inconsistently across different devices.
Core Features & Use Cases
- Detects forbidden device-type branching: Flags direct use of deviceInfo.deviceType inside conditional expressions.
- Detects indirect device-type branching: Finds variables assigned from deviceInfo.deviceType and later used in conditional logic.
- Avoids common false positives: Does not report pure assignments, property accesses, or console log lines.
- Broad source scanning: Scans all ETS/TS/JS source files (not just test files) to ensure complete coverage.
Quick Start
Ask an AI assistant to scan the relevant project’s ETS/TS/JS source files for deviceInfo.deviceType usage in conditionals and report any violations of R006 with file path, line number, and suggested remediation.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: R006: 禁止基于设备类型差异化 Download link: https://github.com/openharmonyinsight/openharmony-skills/archive/main.zip#r006 Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.