-
Notifications
You must be signed in to change notification settings - Fork 580
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
Rust Clippy #1467
base: master
Are you sure you want to change the base?
Rust Clippy #1467
Conversation
bears/rust/RustClippyLintBear.py
Outdated
return True | ||
|
||
def run(self): | ||
args = ('clippy', '--quiet', '--color', 'never', '--', '-Z', 'unstable-options', '--error-format', 'json', '--test') |
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.
E501 line too long (124 > 79 characters)'
PycodestyleBear (E501), severity NORMAL, section autopep8
.
bears/rust/RustClippyLintBear.py
Outdated
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_DETECT = {'Formatting', 'Unused Code', 'Syntax', 'Unreachable Code', 'Smell', 'Code Simplification'} |
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.
E501 line too long (108 > 79 characters)'
PycodestyleBear (E501), severity NORMAL, section autopep8
.
bears/rust/RustClippyLintBear.py
Outdated
return True | ||
|
||
def run(self): | ||
args = ('clippy', '--quiet', '--color', 'never', '--', '-Z', 'unstable-options', '--error-format', 'json', '--test') |
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 does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/rust/RustClippyLintBear.py
+++ b/bears/rust/RustClippyLintBear.py
@@ -31,7 +31,8 @@
return True
def run(self):
- args = ('clippy', '--quiet', '--color', 'never', '--', '-Z', 'unstable-options', '--error-format', 'json', '--test')
+ args = ('clippy', '--quiet', '--color', 'never', '--', '-Z',
+ 'unstable-options', '--error-format', 'json', '--test')
_, stderr_output = run_shell_command(
(self.EXECUTABLE,) + args,
cwd=self.get_config_dir(),
bears/rust/RustClippyLintBear.py
Outdated
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_DETECT = {'Formatting', 'Unused Code', 'Syntax', 'Unreachable Code', 'Smell', 'Code Simplification'} |
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 does not comply to PEP8.
PEP8Bear, severity NORMAL, section autopep8
.
The issue can be fixed by applying the following patch:
--- a/bears/rust/RustClippyLintBear.py
+++ b/bears/rust/RustClippyLintBear.py
@@ -13,7 +13,8 @@
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'[email protected]'}
LICENSE = 'AGPL-3.0'
- CAN_DETECT = {'Formatting', 'Unused Code', 'Syntax', 'Unreachable Code', 'Smell', 'Code Simplification'}
+ CAN_DETECT = {'Formatting', 'Unused Code', 'Syntax',
+ 'Unreachable Code', 'Smell', 'Code Simplification'}
EXECUTABLE = 'cargo'
SEVERITY_MAP = {
# TODO: are there more?
bears/rust/RustClippyLintBear.py
Outdated
return True | ||
|
||
def run(self): | ||
args = ('clippy', '--quiet', '--color', 'never', '--', '-Z', 'unstable-options', '--error-format', 'json', '--test') |
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.
Line is longer than allowed. (124 > 79)
LineLengthBear, severity NORMAL, section linelength
.
Comment on 83391bd. Shortlog of HEAD commit contains a period at end. GitCommitBear, severity NORMAL, section |
bears/rust/RustClippyLintBear.py
Outdated
AUTHORS = {'The coala developers'} | ||
AUTHORS_EMAILS = {'[email protected]'} | ||
LICENSE = 'AGPL-3.0' | ||
CAN_DETECT = {'Formatting', 'Unused Code', 'Syntax', 'Unreachable Code', 'Smell', 'Code Simplification'} |
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.
Line is longer than allowed. (108 > 79)
LineLengthBear, severity NORMAL, section linelength
.
Comment on ce2c3df. Shortlog of HEAD commit contains a period at end. GitCommitBear, severity NORMAL, section |
Comment on bd35f4d. Shortlog of HEAD commit contains a period at end. GitCommitBear, severity NORMAL, section |
Comment on 588e4d2. Shortlog of HEAD commit contains a period at end. GitCommitBear, severity NORMAL, section |
Comment on 3bd43b3. Shortlog of HEAD commit contains a period at end. GitCommitBear, severity NORMAL, section |
7cb9ae4
to
7688df3
Compare
Comment on c6e97fd. Shortlog of HEAD commit isn't in imperative mood! Bad words are 'Debugging' GitCommitBear, severity NORMAL, section |
e9a43e7
to
493bbaf
Compare
Hey! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost! |
Automated rebase was successful! |
e8ea12c
to
86803af
Compare
ack 86803af |
self.assertTrue(len(results) == 1) | ||
|
||
result = results[0] | ||
print(result) |
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.
darn, spotted a print statement, I wanted to ack this!
reack 07508cf |
unack 07508cf I meant... |
ack 1e21230 |
From circle coala logs:
|
ack f10714f |
ack 6ea0d82 |
@rubdos IIUC just remove the print stmt, add a body to the last commit message and file an issue about gitcommitbear should do the trick. |
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 thegit 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 itsPATH
, because of this Rust bug.All workarounds are annotated in the source code.
Checklist
them.
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
rustup.rs
instead ofrustup.sh
. The former is the successor of the latter. We don't want to have to change that, if we can have it today! :)