I want my ci bot to disallow PRs which have some clippy warnings. How can I do that? What should I add to my travis ci to use clippy?
Hm, you could try something like
````yaml
script:
and in your code, add
````rust
````
as documented here: https://github.com/rust-lang-nursery/rust-clippy#allowingdenying-lints
however this
1) from what I know will only work on nightly branch
2) will fail your build as soon as clippy fails to build with latest nightly (when clippy and nightly get out of sync)
so it's quite fragile :/
Over at easage we pin to a known-working nightly / clippy pair to avoid the out-of-sync that @matthiaskrgr mentioned (which is indeed quite painful and fragile).
I believe that removing the allow_failure node would cause Travis to fail a PR if clippy has suggestions.
Pinning a specific clippy and nightly for such checks has more advantages than just "clippy will build", You will also not get any new lints just because a new clippy version has been published. This is a major advantage for your contributors, because they won't have to deal with fixing new lints additionally to their PRs.
A PR updating the clippy and nightly version will then have to deal with the new lints.
Pinning is pretty easy with rust-toolchain support these days BTW. Just create the file and document the compiler version you want to use. cargo will handle it from there.
I wrote about this earlier, so I can add some docs on this.
This is now much easier using clippy-preview, if someone wants to add a small section to the README:
https://github.com/matklad/libsyntax2/pull/55/files
Most helpful comment
I wrote about this earlier, so I can add some docs on this.