-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
add pylint to tox #52
Comments
@mbohlool I'm happy taking this on and have started doing it, however I was curious about all of the autogenerated code. Since much of this is autogenerated, how do we want to fix this? I'd rather not waste time on a bunch of fixup commits that are then blown away the next time things are stepped after an autogeneration is complete. One approach is for me to fix swagger's codegen for python which is doable, but I really was never a java fan and don't relish the thought of installing and dealing with a JDK. |
Run via: TOXENV=lint tox When all of the flake8 problems have been fixed we can add lint to the default envlist. Fixes kubernetes-client#52
I'd also like to fix the requirements and test-requirements to look like every other file out there and not include spaces (ie: the sorted output from pip freeze more or less, but with the >=, etc version specifiers). |
Manual changes to generated code is out of question as you argued. If there is a way to automatically fix some of those problems (look at scripts/update-pep8.sh), we should do it (and we can repeat it after each code generation) otherwise we should just ignore kubernetes.client package in the pylint checks. |
I'd recommend flake8 over pylint. And it's entirely possible to exclude files and paths from linting. I'm assuming generated code is cleanly separated from non-generated code? Here's an example of configuring flake8 in tox.ini: https://github.com/openstack/neutron/blob/master/tox.ini#L132 |
@marun Yeah you just need a @mbohlool funnily enough, I've got some mad sed skills (a career mostly as a sysadmin will do that for you) and was 1/2 tempted to write a script to remove some of the obvious silliness in that autogenerated code. I'll have a go at that first and we can see if it is sensible. Also, do you have thoughts on adding coverage? I'd like to see coverage stats added if possible to this when we run tests. Seeing all of the noop tests that don't do anything does actually make me a bit sad. I'd planned on doing it just like we do in home assistant, another OSS project I contribute to. |
I see value in automating linting of non-generated code, but I don't see the point of doing the same for generated code. If linting reveals functional problems with the generated code, the place to fix it is in the generator. Scripted cleanup can't help but be brittle in the face of generator changes. |
@mbohlool Cool, I can update my branch with those changes (excluding tests and kubernetes/client) and send it up tonight or tomorrow. I also added the py35 environment since my workstation distro, Fedora 25, lacks python 3.4, but default installs 3.5 |
@SEJeff use pyenv to create as much environment as you like and activate 3.4 and 2.7 for this repo: pip install pyenv
pyenv install 2.7.12
pyenv install 3.4.3
cd client-python
pyenv local 2.7.12 3.4.3 You may need to restart your shell for it to take effect but tox should pick up these two newly installed version. I've never tested the whole client with 3.5 yet. |
Run via: TOXENV=lint tox When all of the flake8 problems have been fixed we can add lint to the default envlist. Fixes kubernetes-client#52
Feel free to give this a go via:
And to run the flake8 task:
I'm not sure of the best way to silence the errors in kubernetes.init, kubernetes.watch.init, and kubernetes.config.init. The most obvious thing is So the choices I see are:
I'm certainly not in love with 1, but it seems like the least evil. By design, there is no way to exclude specific errors globally from a specific file in flake8. What do you prefer? Once this is done, I'll enable it by default and I can open a PR for it. |
init files suppose to be all imports (at least for us), I think (2) is better, just ignore init files. |
Look like we have a 4th option:
__all__ = ["ConfigException", "load_incluster_config",
"list_kube_config_contexts", "load_kube_config"] I think this 4th option is sightly better than 2nd one. |
May be we should add the pep8/flake8 to the python-base |
/assign @iamneha |
@iamneha: GitHub didn't allow me to assign the following users: iamneha. Note that only kubernetes-client members and repo collaborators can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
following up on @marun's comment on #50:
The text was updated successfully, but these errors were encountered: