Linux command
mh_metric 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Calculate metrics
mh_metric [file.m]
Analyze
mh_metric [src/]
Output
mh_metric --json=[metrics.json] [file.m]
Output
mh_metric --html=[metrics.html] [file.m]
Output
mh_metric --text=[metrics.txt] [file.m]
Example
mh_metric --ci [src/]
说明
mh_metric computes code metrics for MATLAB and Octave files and reports violations when metrics exceed acceptable levels. It measures cyclomatic complexity, number of lines, function length, nesting depth, and other code quality indicators. The tool is part of the MISS_HIT suite. If no files or directories are specified, it analyzes the entire working directory and all subdirectories. Configuration can be provided via miss_hit.cfg files in the project tree.
参数
- --json=_FILE_
- Write metrics report in JSON format to the specified file.
- --html=_FILE_
- Write metrics report in HTML format to the specified file.
- --text=_FILE_
- Write metrics report in plain text format to the specified file.
- --ci
- CI mode. Suppresses the overall report and only reports metric violations.
- --ignore-justifications-with-tickets
- Ignore any justifications in code that mention a ticket reference.
- --help
- Display help information.
FAQ
What is the mh_metric command used for?
mh_metric computes code metrics for MATLAB and Octave files and reports violations when metrics exceed acceptable levels. It measures cyclomatic complexity, number of lines, function length, nesting depth, and other code quality indicators. The tool is part of the MISS_HIT suite. If no files or directories are specified, it analyzes the entire working directory and all subdirectories. Configuration can be provided via miss_hit.cfg files in the project tree.
How do I run a basic mh_metric example?
Run `mh_metric [file.m]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --json=_FILE_ do in mh_metric?
Write metrics report in JSON format to the specified file.