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

rough flake8 integration #212

Merged
merged 1 commit into from Mar 10, 2015

Conversation

Projects
None yet
2 participants
@collinanderson
Contributor

collinanderson commented Mar 4, 2015

No description provided.

@collinanderson collinanderson force-pushed the collinanderson:flake8 branch from 985eab8 to e6cd596 Mar 4, 2015

@@ -7,5 +7,6 @@ alabaster>=0.6.0
nose==1.3.0
spec>=0.11.1
mock==1.0.1
flake8

This comment has been minimized.

@bitprophet

bitprophet Mar 5, 2015

Member

Can you stick the latest stable release number in here as an ==? thanks!

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

done

@@ -1,6 +1,9 @@
# Fuckin' A.
import select, errno, os, sys
import errno

This comment has been minimized.

@bitprophet

bitprophet Mar 5, 2015

Member

Unclear why this file is being touched, it's gone in HEAD. Can you try rebasing on latest HEAD perhaps?

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

Ahh. Yup. I took too long making the change :)

@@ -88,7 +88,7 @@ def parse_argv(self, argv):
# flag value and still in valid parsing territory (i.e. not in
# "unknown" state which implies store-only)
if not machine.waiting_for_flag_value and is_flag(token) \
and not machine.result.unparsed:
and not machine.result.unparsed:

This comment has been minimized.

@bitprophet

bitprophet Mar 5, 2015

Member

Is 8-space indents on continuations a flake8 thing? It's not my preferred style :( (Honestly, I thought flake8 would complain about backslash continuations entirely, parentheticals are better anyway).

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

It just doesn't want the conditional indented at the same level as the code.

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

E129 visually indented line with same indent as next logical line

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

This is now ignored under E125 for now.

setup.cfg Outdated
@@ -0,0 +1,4 @@
[flake8]
exclude=invoke/vendor,sites,tests

This comment has been minimized.

@bitprophet

bitprophet Mar 5, 2015

Member

Any particular reason to exclude tests?

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

I force-pushed a change that now includes tests too. I just didn't want the diff to be too big :)

setup.cfg Outdated
@@ -0,0 +1,4 @@
[flake8]
exclude=invoke/vendor,sites,tests
ignore=E124,E125,E128,E261,E302,E402,F401,W503,E712,F821

This comment has been minimized.

@bitprophet

bitprophet Mar 5, 2015

Member

I should look these up to see what they are, am not a linting expert.

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

Yeah, I figure start with a lot of them ignored. If individual ones get fixed they can be removed from this list.

This comment has been minimized.

@collinanderson

collinanderson Mar 5, 2015

Contributor

Basically, you can remove one from the list, then run flake8 to see what lines they apply to.

@bitprophet

This comment has been minimized.

Member

bitprophet commented Mar 5, 2015

Thanks for poking at this! See line comments :)

@bitprophet

This comment has been minimized.

Member

bitprophet commented Mar 5, 2015

Also linking to #157 which this kinda supersedes.

@collinanderson collinanderson force-pushed the collinanderson:flake8 branch from e6cd596 to 038630c Mar 5, 2015

@bitprophet

This comment has been minimized.

Member

bitprophet commented Mar 9, 2015

Thanks for making those updates. Annoyingly, I didn't notice last time that there's apparently a rule for double spaces before line comments (e.g. foo = blah # lol) - this is another spot where I personally diverge from core PEP8. Sorry I didn't catch that earlier :(

Went and checked on all the stuff ignored/not ignored to see if I agree (I'd like to choose a single set of these rule ignores so I can apply them eventually to all of my projects :))...results:

  • As above, I'm thinking we ignore E261 (two spaces before line comments).
  • Why ignore F401 (module imported but unused)? When I run w/ it un-ignored I see 90% correct catches of unused imports (boy I should've put linting in before! thanks again for the PR...), with a handful of __init__.py convenience imports that we can presumably explicitly ignore.
  • I don't see W503 in pep8's docs, what's it do?
  • E711 and E712 - offhand I'd agree with those errors if they popped up. If I remove those from a copy of your branch, I see a handful of alerts and they all seem legit (where we use == instead of the arguably more correct is).
  • F811 and F821 also sound like rules I'd agree with if they alerted, and as above, if I remove them it does find some things I would consider errors :)

@collinanderson collinanderson force-pushed the collinanderson:flake8 branch 2 times, most recently from 8c29dba to 281b22e Mar 10, 2015

@collinanderson

This comment has been minimized.

Contributor

collinanderson commented Mar 10, 2015

Don't worry, I added two space comments in the second change which is why you didn't catch it the first time. :)

I originally ignored all of the import cleanup just to keep the diff small enough. Here it is with all of the import cleanup.

@collinanderson collinanderson force-pushed the collinanderson:flake8 branch from 281b22e to 82c3a3f Mar 10, 2015

@collinanderson collinanderson force-pushed the collinanderson:flake8 branch from 82c3a3f to 83c633e Mar 10, 2015

@bitprophet bitprophet added the Support label Mar 10, 2015

@bitprophet bitprophet merged commit 83c633e into pyinvoke:master Mar 10, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

bitprophet added a commit that referenced this pull request Mar 10, 2015

@bitprophet

This comment has been minimized.

Member

bitprophet commented Mar 10, 2015

Looks good, thanks again! I might tweak that ignores list more in future but this is a great start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment