coala-bears icon indicating copy to clipboard operation
coala-bears copied to clipboard

Rust Clippy

Open rubdos opened this issue 7 years ago • 71 comments

This is mostly finished now. This integrates rust-clippy with coala, which is the de-facto standard linter for Rust.

I had to work around some stuff. CircleCI uses a rewrite for github clone urls in their default .gitconfig file. As cargo, which is the Rust package manager, doesn't like that, I had to circumvent that. When this issue, which I am tracking, closes, I'll come and remove the workaround. It consists of the git config --global --unset url.ssh://[email protected]:.insteadof option in checkout: post, and the if test in the .ci/deps.sh file. The if test is there to distinguish CircleCI from travis at that point.

On Windows, the clippy linter needs some weird directories in its PATH, because of this Rust bug.

All workarounds are annotated in the source code.

Checklist

  • [x] I read the commit guidelines and I've followed them.
  • [x] I ran coala over my code locally. (All commits have to pass individually. It is not sufficient to have "fixup commits" on your PR, our bot will still report the issues for the previous commit.) You will likely receive a lot of bot comments and build failures if coala does not pass on every single commit!

TODO

  • [x] Use rustup.rs instead of rustup.sh. The former is the successor of the latter. We don't want to have to change that, if we can have it today! :)
  • [ ] @jayvdb says this is blocked on https://github.com/coala/coala/issues/3867

rubdos avatar Feb 27 '17 17:02 rubdos

Comment on 83391bd1f0bef1c993fad143d6699a476083581e.

Shortlog of HEAD commit contains a period at end.

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 27 '17 17:02 gitmate-bot

Comment on ce2c3df76f1b14913bb54b714b14b2284834537b.

Shortlog of HEAD commit contains a period at end.

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 27 '17 18:02 gitmate-bot

Comment on bd35f4dfc4c388b63c59feb0722c7a04571759d4.

Shortlog of HEAD commit contains a period at end.

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 28 '17 10:02 gitmate-bot

Comment on 588e4d2973178d1fe477b5cfbc4431ca75af2032.

Shortlog of HEAD commit contains a period at end.

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 28 '17 11:02 gitmate-bot

Comment on 3bd43b316d24d8c8626d11428fb3bf24231792cd.

Shortlog of HEAD commit contains a period at end.

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 28 '17 12:02 gitmate-bot

Comment on c6e97fd77161508491d74cb85c5b1be735eab1c1.

Shortlog of HEAD commit isn't in imperative mood! Bad words are 'Debugging'

GitCommitBear, severity NORMAL, section commit.

gitmate-bot avatar Feb 28 '17 13:02 gitmate-bot

As soon as the PR is in ready-to-merge state, remove the WIP: in the title @rubdos so it appears in our pending-review list :)

Makman2 avatar Mar 01 '17 23:03 Makman2

As soon as the PR is in ready-to-merge state, remove the WIP: in the title @rubdos so it appears in our pending-review list :)

Can someone look at the travis-ci/circleci stuff? Appveyor crashes because of the checkstyle.jar bug, but I don't see why travis/circleci crash.

I took away the WIP yesterday, because I wanted someone to review that :/

rubdos avatar Mar 02 '17 09:03 rubdos

ah sorry... though for specific issues rather ping us on gitter ;)

The checkstyle bug should have been fixed I believe. Try to rebase to master, if it still fails I'll clean the cache. If it then doesn't work, then we haven't fixed it :3

Makman2 avatar Mar 02 '17 14:03 Makman2

and about travis: no idea, try to restart the build via the rebase. If it still persists we need to look at it closer^^

Makman2 avatar Mar 02 '17 14:03 Makman2

The checkstyle bug should have been fixed I believe. Try to rebase to master, if it still fails I'll clean the cache. If it then doesn't work, then we haven't fixed it :3

I am on master... :/

rubdos avatar Mar 02 '17 14:03 rubdos

I somehow broke Windows again. Damn. Will try to fix during next week.

rubdos avatar Mar 03 '17 21:03 rubdos

~~TODO before merge: use newer versions of Rust and clippy in the CI.~~

rubdos avatar Mar 06 '17 12:03 rubdos

Does clippy have a CLI argument for the filename? If so, that will be easier and more useful than a config dir. (see git grep settings.*_config to get you on the right path).

The get_config_dir problem does look like a bug, either in the core library or in the test framework. Would love to see a bug raised about that, or further discussion on that chat to isolate it a bit more.

jayvdb avatar Mar 07 '17 03:03 jayvdb

Does clippy have a CLI argument for the filename? If so, that will be easier and more useful than a config dir. (see git grep settings.*_config to get you on the right path).

No, clippy is a compiler plugin and compiles the rust project, afaik.

The get_config_dir problem does look like a bug, either in the core library or in the test framework. Would love to see a bug raised about that, or further discussion on that chat to isolate it a bit more.

Ok, I'll make sure to do that.

rubdos avatar Mar 07 '17 11:03 rubdos

Err. Is there a CLI argument to specify where to find Cargo.toml. i.e. can we avoid relying on the current working directory.

Is clippy designed to be run on many files together, at once, or one file at a time? If one file at a time, does the order of files process matter?

jayvdb avatar Mar 07 '17 11:03 jayvdb

Err. Is there a CLI argument to specify where to find Cargo.toml. i.e. can we avoid relying on the current working directory.

Oh, that's extremely interesting. Let me check that out. That would solve a lot of troubles :)

Can I let that option default to get_config_dir()?

Is clippy designed to be run on many files together, at once, or one file at a time? If one file at a time, does the order of files process matter?

It is designed as a cargo plugin, so it hook into the build tool. I don't think you can use it on one file at a time, and I also think that certain lints (e.g. "unused code" lints) won't work one file at a time.

rubdos avatar Mar 07 '17 11:03 rubdos

Can I let that option default to get_config_dir()?

You know what, I'll just not specify it. I think that's the most logical after all?

rubdos avatar Mar 07 '17 11:03 rubdos

Err. Is there a CLI argument to specify where to find Cargo.toml. i.e. can we avoid relying on the current working directory.

@jayvdb Seems like there is one, but bugged :'( I posted an issue on their tracker.

https://github.com/Manishearth/rust-clippy/issues/1611

rubdos avatar Mar 07 '17 14:03 rubdos

Found it. People reporting bugs in Russian makes it difficult to Google :/

And here is the English version

rubdos avatar Mar 07 '17 18:03 rubdos

CircleCI fails on timeout.

rubdos avatar Mar 08 '17 09:03 rubdos

Okay, I'm ready for reviews now, I think.

One thing I'd like to ask: how do you guys like these commits? Everything squashed together? I currently have one commit per CI system:

  • CircleCI (which also writes the .ci/deps.sh thing, we might want it squashed with Travis, because of .ci/deps.sh)
  • Travis (which sets the cache and PATH on Travis)
  • AppVeyor (which is an atomic commit, downloading and installing Rust on AppVeyor)

Then two other commits:

  • Adding the RustClippyLintBear and its test, which works perfectly from the first time on all CI, because it has been set up!
  • Add Rust to the README of supported languages.

You guys want everything squashed together? Or in a bunch of steps?

rubdos avatar Mar 08 '17 10:03 rubdos

@jayvdb says this is blocked on https://github.com/coala/coala/issues/3867

rubdos avatar Mar 09 '17 07:03 rubdos

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

gitmate-bot avatar Mar 17 '17 21:03 gitmate-bot

@gitmate-bot is very friendly there, but could someone have a look at #3867 ?

rubdos avatar Mar 18 '17 20:03 rubdos

I rebased against master (had some conflicts in the CI files), and I made sure that clippy only outputs severity levels that we know of (I trigger all "kinds" in the test_bad): Allow, Deny, Warning. Only Deny and Warning are reported (as error and warning, respectively)

rubdos avatar Mar 20 '17 16:03 rubdos

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

gitmate-bot avatar Mar 27 '17 14:03 gitmate-bot

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

gitmate-bot avatar Apr 03 '17 13:04 gitmate-bot

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

gitmate-bot avatar Apr 10 '17 12:04 gitmate-bot

Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again!

gitmate-bot avatar Apr 21 '17 03:04 gitmate-bot