Skip to content

CLI 参考

diff-cover

bash
diff-cover [coverage_files...] [options]

覆盖率文件可以是 lcov.info,也可以是 Cobertura、Clover、JaCoCo 或通用 XML 报告。

选项说明
--format <value>输出格式,例如 html:coverage.html,json:coverage.json
--show-uncovered在控制台报告中显示未覆盖的变更行。
--expand-coverage-report根据上一行命中情况补全报告缺失行。
--external-css-file <file>将报告 CSS 写入独立文件,并从 HTML 中引用。
--src-roots <dirs...>JaCoCo 路径解析使用的源码根目录。

diff-quality

bash
diff-quality [reports...] --violations <driver> [options]

支持的驱动包括 eslintpylintflake8shellcheckcppcheckcheckstylefindbugs

选项说明
--violations <driver>静态分析驱动,默认 eslint
--html-report <file>输出 HTML 报告。
--json-report <file>输出 JSON 报告。
--options <options>传给驱动命令的额外选项。
--report-root-path <path>用于规范化报告文件路径的根目录。

共享选项

选项说明
--compare-branch <branch>用于对比的分支或引用,默认 origin/main
--fail-under <score>diff 得分低于该值时以退出码 1 结束。
--ignore-staged忽略已暂存变更。
--ignore-unstaged忽略未暂存变更。
--include-untracked包含未跟踪文件。
--exclude <patterns...>按 glob 排除文件。
--include <patterns...>按 glob 包含文件。
--diff-range-notation <range>使用 ..... Git diff 范围。
--ignore-whitespace忽略纯空白变更。
--config-file <file>读取 TOML 配置。
--diff-file <file>从保存的 diff 文件读取,而不是执行 Git。
--total-percent-float总分保留两位小数。