3 个版本
| 0.1.2 | 2021 年 5 月 4 日 |
|---|---|
| 0.1.1 | 2021 年 5 月 3 日 |
| 0.1.0 | 2021 年 5 月 3 日 |
#15 在 #git-diff
805 每月下载量
18KB
363 代码行
Cargo diff-tools
运行 cargo check 和 cargo clippy,隐藏那些主要行不包括在 git diff 中的警告信息。在大型项目中使用,可以隐藏那些可能与 pull request 所做的更改无关的警告信息。
灵感来源于 Patryk27/clippy-dirty。
示例
运行 cargo clippy,隐藏那些主要行不包括在 git origin/master HEAD 中的警告信息。
cargo-clippy-diff origin/master HEAD
相同,对于 cargo check。
cargo-check-diff origin/master HEAD
支持各种 git diff 参数。
cargo-clippy-diff HEAD # internally calls `git diff HEAD`
cargo-clippy-diff --staged # internally calls `git diff --staged`
cargo-clippy-diff first-branch...second-branch origin/master # and so on
将 cargo check 参数放置在 -- 之后。
cargo-check-diff HEAD -- --all-features
将 cargo clippy 参数放置在 -- 之后(注意,第二个 -- 是 clippy 的参数之一)。
cargo-clippy-diff HEAD -- --all-features -- -D clippy::lint_name
要显示诊断信息为 JSON 对象,请使用 --output=json。
cargo-clippy-diff --output=json origin/master HEAD
要将诊断信息以GitHub Actions 工作流命令的形式显示(有助于自动添加评论到拉取请求中),请使用--output=github
git fetch origin $GITHUB_BASE_REF --depth=1
cargo-clippy-diff --output=github $(git merge-base origin/$GITHUB_BASE_REF $GITHUB_SHA) $GITHUB_SHA
# Example output "::warning file=lib.rs,line=4,col=2::Missing semicolon"
对于其他cargo命令,可以使用filter-by-diff来过滤任何JSON诊断流
cargo build --message-format=json-diagnostic-rendered-ansi \
| filter-by-diff --output=rendered origin/master HEAD
依赖项
~3.5–5.5MB
~95K SLoC