rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
2.01k stars 202 forks source link

Enforce clippy in CI #406

Closed Dirbaio closed 2 years ago

Dirbaio commented 2 years ago

Depends on #394

CI wasn't actually enforcing clippy, because actions-rs/clippy-check needs to run as pull_request_target to get the token to add the "fancy" comments to the diff. It does nothing when ran as pull_request.

pull_request_target is troublesome because it uses the yaml from master instead of from the PR branch, which means when bumping clippy you don't know whether CI passes until after it's merged. I've made it use cargo clippy instead, which works on pull_request.

rust-highfive commented 2 years ago

r? @ryankurte

(rust-highfive has picked a reviewer for you, use r? to override)

Dirbaio commented 2 years ago

If we keep clippy but not enforcing it, the moment we decide to not fix a warning because we don't agree with it, all following PRs will have the red :x: forever, due to an issue unrelated to the PR. At that point it stops being a useful flag for code review, and it's also confusing for contributors because a red :x: in a PR usually means you did something wrong.

IMO if we keep it we should enforce it, otherwise we should remove it.

Dirbaio commented 2 years ago

making unnecessary/unrelated/even contestable changes in unrelated crates in order to land PRs.

Random warnings won't appear when landing a feature PR, because the clippy version is pinned. We can update it in dedicated PRs, so the changes for any new warnings don't mix with normal PRs.

eldruin commented 2 years ago

Up to you @ryankurte, @therealprof

bors[bot] commented 2 years ago

Build succeeded: