Closed cclauss closed 5 years ago
Normally how we'd do this is run flake8 (or any other linter) the same as one of the test jobs / Presubmit checks on PRs. Set up a job then you can /test pull-foo-flake8
I'm not sure this warrants it's own command. All of the tooling necessary for running any other test should work well for linters.
On Fri, Jul 13, 2018, 00:13 cclauss notifications@github.com wrote:
It would be super cool if we could teach @k8s-ci-robot https://github.com/k8s-ci-robot a new command, /flake8-core which would execute flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics which is a really nice sanity check of Python code.
And maybe another new command /flake8-strict which would execute flake8 . --count --show-source --statistics
E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. The other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
- F821: undefined name name
- F822: undefined name name in all
- F823: local variable name referenced before assignment
- E901: SyntaxError or IndentationError
- E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kubernetes/test-infra/issues/8676, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4Bq4Xv4ovqh9foV2rjz5Wlj8BpDpKoks5uGEh8gaJpZM4VOaPf .
Do we really need to have users manually set up a job?
Doesn't @k8s-ci-robot already know everything that it needs to know to automatically set up a lint job given that the commands in question do not change from one repo to the next?
I discovered this need by going to https://github.com/tensorflow/minigo and wanting to run a test that the maintainers had not previously considered. I am not a maintainer so I had perform a number of manual steps on my local machine and then encourage the maintainers to repeat those same steps in their repo so they could see what I was seeing.
In a ployglot repo the maintainers might be focused on language A but they might have a showstopper bug in a single script written in language B. Instead of asking them to change their Travis/Circle/Jenkins file to rediscover the bug that I am seeing, I could merely encourage them to /lint-language-B
In the case of /flake8-core, @k8s-ci-robot would merely need to:
This does not change from on repo to the next and I believe that this approach would work consistently across almost all language linters.
The current /lint command runs golint on all modified files in a PR. That would be useful to have for other languages.
Do we really need to have users manually set up a job?
Yes, we should focus on making that easier..
In the case of /flake8-core, @k8s-ci-robot would merely need to:
Everything except step 4) is a what a normal job might do. 4 can still be accomplished by a tool that runs in a job.
We have excellent capacity for scaling execution within test jobs, and a lint test being run is not different from any other test. There are also security concerns to running linter scripts within Prow instead of in the build & test clusters.
I think the answer here is for someone to write a reusable flake8 script, optionally with commenting support. If it's only posting a comment with the output though, I don't think that's more helpful than the output of any other job, which we also have better support for and can handle longer output better.
The current /lint command runs golint on all modified files in a PR. That would be useful to have for other languages.
This isn't widely used. The reason we have this built into Prow is:
The /lint command in fact only runs on the modified code. It doesn't lint the whole tree, which is something else golint as a go librarary gives us, and is why we don't have say, gometalinter instead.
The other problem we've avoided so far just by not upgrading the library and by not having much usage of /lint is that if we have a global linter baked in upgrading the underlying linter is a breaking change across all the repos under that CI. Upgrades to tools like this really should be rolled out per-repo.
The lint-as-presubmit model has worked well there, and as a bonus it allows making the lint script / lint failures a blocking failure for PR merges, which is typically how we see them used.
Thanks... I will study up over the weekend.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
.
Mark the issue as fresh with /remove-lifecycle rotten
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close
@fejta-bot: Closing this issue.
It would be super cool if we could teach @k8s-ci-robot a new command, /flake8-core which would execute flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics which is a really nice sanity check of Python code.
And maybe another new command /flake8-strict which would execute flake8 . --count --show-source --statistics
E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. The other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.
name
name
in__all__
name
referenced before assignment