-
Notifications
You must be signed in to change notification settings - Fork 833
Run clippy on all the codebase #555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run clippy on all the codebase #555
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pull request!
I agree about the more pendantic checks. I thinks it's best to merge this first and then tackle the others in a new pull request.
For reference, this fixes #365.
Codecov Report
@@ Coverage Diff @@
## master #555 +/- ##
==========================================
+ Coverage 87.61% 87.64% +0.02%
==========================================
Files 65 65
Lines 3449 3449
==========================================
+ Hits 3022 3023 +1
+ Misses 427 426 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #555 +/- ##
===========================================
+ Coverage 55.8% 87.61% +31.81%
===========================================
Files 83 65 -18
Lines 5767 3449 -2318
Branches 1022 0 -1022
===========================================
- Hits 3218 3022 -196
+ Misses 1757 427 -1330
+ Partials 792 0 -792
Continue to review full report at Codecov.
|
ci/travis/setup.sh
Outdated
@@ -7,7 +7,7 @@ set -e | |||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=$TRAVIS_RUST_VERSION | |||
export PATH=$PATH:$HOME/.cargo/bin | |||
if [ "$TRAVIS_JOB_NAME" = "Minimum nightly" ]; then | |||
rustup component add clippy | |||
rustup component add clippy || cargo install --git https://github.com/rust-lang/rust-clippy/ --force clippy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is fine, I just wanted to note that I only pinned nightlies in .travis.yml that have clippy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correction: I actually think we should revert the change in .travis.yml because the master of clippy is not compatible with that rustc version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@konstin I saw the issue and you're right ... we cannot build the latest clippy available with the min rust compiler supported by the project.
The major issue here is that instally clippy on nightly-2019-06-22
does not work anymore even if it should be present (according to static.rust-lang.org).
An example of build failure is available here).
What would be your suggestion in this case?
My current idea would be to modify travis such that Minimum nightly
task runs only tests and a new task (ie. Lints
) will be added to uniquely run cargo fmt
and cargo clippy
.
Waiting for your feedback before continuing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion is to revert the changes in .travis.yml
and to setup.sh
. That way ci should pass again. If that clippy version has bugs fixed in newer versions, we could bump the minimum nightly to e.g. nightly-2019-08-01
, which also has clippy and rustfmt. (See https://rust-lang.github.io/rustup-components-history/)
I don't think we should check tests/examples codes... |
Why not? Shouldn't the test code also be in good shape so that it can serve as example on how to use PyO3? |
Yeah, but I feel |
I see, it's definitely noisy. But as long as the constructor has the |
Imo the problem is that the signature that pyo3 requires is wrong; There's no reason why the |
I'm going to rebase this PR out off the current master (to keep a cleaner history). |
Add fallback to install clippy from github repo if rustup component add fails
b00c776
to
d409cde
Compare
Test compilation issues with latest nightly version are happening on master as well (https://travis-ci.com/macisamuele/pyo3/jobs/226035909#L789). I did check proc-macro-hack builds (used under the hood by
I was not able to trace the specific cause of the issue. |
d409cde
to
f15fa21
Compare
@macisamuele |
I found the cause dtolnay/proc-macro-hack#40 |
Thank you! |
The main objective of this PR is to ensure that:
I would like to enable more pedantic checks like
doc_markdown
,use_self
andif_not_else
but they would generate a pretty high amount of changes (and so potential merge conflicts), so I'm not publishing a PR for now but limiting on having a clear environment such that restrictions can be added without having un-needed noise.Side note: I've updated .travis.yml to reflect the min rust nightly version specified in build.rs