-
Notifications
You must be signed in to change notification settings - Fork 7k
Add cython-lint to pre-commit #57699
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
Conversation
c32f0df to
68435ab
Compare
edoakes
left a comment
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.
Looks like a nice addition. Are the changes here all of the errors from enabling the linter?
python/ray/_raylet.pyx
Outdated
|
|
||
| def function_executor(*arguments, **kwarguments): | ||
| function = execution_info.function | ||
| function = execution_info.function # no-cython-lint |
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.
what needed to be skipped here?
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.
Because function shadows the globally-imported symbol here:
Line 60 in 68435ab
| from libcpp.functional cimport function |
We can either turn off the lint of this line, or rename this local function variable. Do you have a preference?
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.
let's rename the local variable to avoid any # no-cython-lint
python/ray/_raylet.pyx
Outdated
| increase_recursion_limit() | ||
|
|
||
| eventloop, async_thread = self.get_event_loop( | ||
| eventloop, _async_thread = self.get_event_loop( |
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.
is _async_thread unused?
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.
that's right!
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.
to follow convention in the rest of the code, let's just do:
| eventloop, _async_thread = self.get_event_loop( | |
| eventloop, _ = self.get_event_loop( |
| rev: v0.17.0 | ||
| hooks: | ||
| - id: cython-lint | ||
| args: [--no-pycodestyle] |
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.
what is this flag for?
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.
pycodestyle runs some more nitpicky lints, like
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2324:89: E501 line too long (108 > 88 characters)
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2330:5: E303 too many blank lines (2)
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2528:6: E111 indentation is not a multiple of 4
/home/marcogorelli/ray-dev/python/ray/_raylet.pyx:2528:6: E117 over-indented
so for a first iteration I kept them out
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.
these look good to me too, maybe open a 2nd PR that removes the --no-pycodestyle?
|
thanks for your review! yes, that's right |
debd15b to
689d10d
Compare
|
Triggered CI run and enabled auto-merge. If CI passes the PR will merge. If not, please ping me. Thanks again for the contribution! |
|
thanks @edoakes !
looks like it didn't go, should i fetch upstream and rebase? |
Head branch was pushed to by a user without write access
689d10d to
a2d8fd2
Compare
Signed-off-by: Marco Gorelli <[email protected]>
a2d8fd2 to
bf2a903
Compare
I was testing out `cython-lint` and figured I'd open a PR to see if there was interest This flags some issues here such as: - unused imports - unused variables - "pointless string statements" - f-string without placeholders Signed-off-by: Marco Gorelli <[email protected]>
I was testing out `cython-lint` and figured I'd open a PR to see if there was interest This flags some issues here such as: - unused imports - unused variables - "pointless string statements" - f-string without placeholders Signed-off-by: Marco Gorelli <[email protected]>
I was testing out `cython-lint` and figured I'd open a PR to see if there was interest This flags some issues here such as: - unused imports - unused variables - "pointless string statements" - f-string without placeholders Signed-off-by: Marco Gorelli <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
I was testing out `cython-lint` and figured I'd open a PR to see if there was interest This flags some issues here such as: - unused imports - unused variables - "pointless string statements" - f-string without placeholders Signed-off-by: Marco Gorelli <[email protected]>
I was testing out `cython-lint` and figured I'd open a PR to see if there was interest This flags some issues here such as: - unused imports - unused variables - "pointless string statements" - f-string without placeholders Signed-off-by: Marco Gorelli <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
I was testing out
cython-lintand figured I'd open a PR to see if there was interestThis flags some issues here such as:
Why are these changes needed?
Related issue number
Checks
git commit -s) in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.