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
WIP: Add a pylintrc to make it easire to use linter #1442
Conversation
There is no style guide, as you can probably tell from looking at the code :) I wonder if we should use a minimal .pylintrc that only includes the defaults we're overriding, rather than including everything, which makes it hard to see what's actually relevant. Here's what I use for myself (I think, I also have all the default options included so it's hard for me to tell what I changed):
I've found this useful for finding errors without complaining about our rampant PEP8 violations. What do you think? Wanna give this a try and see if we can start from here? |
I used yours and added redefined-outer-name and redefined-builtin to the disables and set indentation to 2 spaces. What do you guys think of using yapf with the chromium style? I think using it and this pylintrc could make jax development easier. |
jax/numpy/lax_numpy.py
Outdated
@@ -11,7 +11,6 @@ | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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.
Can you revert this file for now? I like the idea of auto-formatting, but let's do one thing at a time :)
pylintrc
Outdated
# be loaded. Extensions are loading into the active Python interpreter and may | ||
# run arbitrary code | ||
extension-pkg-whitelist=numpy | ||
indent-string=" " |
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.
nit: if you're gonna keep the [MASTER], etc. headings, indent-string goes under [FORMAT]. Or just remove the headings. Also, please put a blank line between the different directives.
Looks good except for the minor comments I left, thanks! I have limited experience with Python formatters, mostly because I think they don't do a great job... looking at the file you formatted, it looks like it creates a lot of unnecessary vertical space, like by breaking up function arguments on separate lines. Maybe there are settings to make it format things more concisely? |
Just in case you didn't see the other comment, can you revert the lax_numpy.py formatting changes? |
wow, I hadn't seen it, I will revert it and remove the yapf style file. The only change I will keep on lax is removing the pylint comments since they've been incorporated on pylintrc, ok? |
Looks great, thanks! |
This reverts commit a0bb2c0. Temporarily reverting this to see if it's causing the github workflow failures.
Right now it's just using the same pylintrc as tensor2tensor, I'm trying to tell it to ignore C0103 (since jax doesn't seem to follow PEP8 variable's name guidelines).
Is there anything like a style guide for contributing to jax?