Linux command
drupal-check 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check module for
drupal-check [modules/custom/mymodule]
Check with analysis
drupal-check -a [modules/custom/mymodule]
Check for Drupal 10
drupal-check --drupal-root=[.] [modules/custom/mymodule]
Output in format
drupal-check --format=[json] [path]
Check multiple paths
drupal-check [path1] [path2]
说明
drupal-check is a static analysis tool that checks Drupal code for deprecated API usage and other issues. It helps prepare modules for Drupal version upgrades by identifying code that needs updating. The tool uses PHPStan for static analysis with Drupal-specific rules. It detects usage of deprecated functions, classes, and services that will be removed in future Drupal versions. drupal-check is essential for maintaining Drupal modules and ensuring compatibility with upcoming releases.
参数
- -d, --deprecations
- Check for deprecated API usage (default behavior).
- -a, --analysis
- Run general static analysis checks.
- -s, --style
- Run code style checks.
- --php8
- Use PHPStan phpVersion 8.1 (Drupal 10 requirement).
- --drupal-root _PATH_
- Path to the Drupal root.
- --format _FORMAT_
- Output format: raw, table, checkstyle, json, or junit (default: table).
- --memory-limit _LIMIT_
- Memory limit for analysis (e.g. 1G).
- -e, --exclude-dir _DIRS_
- Comma-separated directories to exclude.
- --no-progress
- Suppress the progress bar.
- -v, -vv, -vvv
- Increase output verbosity.
- -h, --help
- Display help information.
FAQ
What is the drupal-check command used for?
drupal-check is a static analysis tool that checks Drupal code for deprecated API usage and other issues. It helps prepare modules for Drupal version upgrades by identifying code that needs updating. The tool uses PHPStan for static analysis with Drupal-specific rules. It detects usage of deprecated functions, classes, and services that will be removed in future Drupal versions. drupal-check is essential for maintaining Drupal modules and ensuring compatibility with upcoming releases.
How do I run a basic drupal-check example?
Run `drupal-check [modules/custom/mymodule]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --deprecations do in drupal-check?
Check for deprecated API usage (default behavior).