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
code formatting #113
code formatting #113
Conversation
:-P I'm not offended, though I feel I should point out your language is quite forward. Firstly, I need educating as to why trailing whitespace is an issue. And which trailing whitespace are we talking about? All of it?
|
@schmitts Are you planning to make a PR? If not I can run |
If you could run the autopep8 that would be perfect. @pwaller: Are you fine with it although I did not found the time to |
Go ahead, though I'd like to look at the result before it is merged. @schmitts, I'd also like to know more about why you think it is especially a problem. Most sane tools can deal with it without making a huge mess of things. You can do diffs and merging which ignore whitespace. Not to say I think there should be tons of the stuff extraneously. I just don't see why it warrants an issue by itself. |
@pwaller: I use incremental patches a lot (aka add -p). I could not find |
I too use |
@pwaller: Sorry, yes, you are right. I do remove the whitespace |
ok! Well now I then understand why it's a problem. Hmm. One thing is that I don't use emacs, I tend to use pretty dumb editors like gedit and nano and I don't care enough about the issue to configure them to remove trailing whitespace. I'd like to add that pep8 doesn't say anything about trailing whitespace, so I don't know if autopep8 will solve the problem. The more I think about the problem (and I've already wasted 20 minutes thinking about it and reading up on it), I don't really like the idea of adding trailing whitespace to the list of things that has to be cared about. How hard is it to configure emacs not to care for weboot? There are quite a few problems to solve if you want to keep the option turned on and not have it disturb your workflow. It seems we're not the first to encounter this sort of problem. At the very least I'd need a script with the exact behaviour of emacs otherwise I'd just reintroduce things which emacs thinks are whitespace errors. And then I'd have to take care that the script is working and doing the right thing, and it's another thing which can fail - it would just create more work for me, and others who contribute to the project with minor whitespace errors. That's just my current feeling, it's not a very strong one, I'm just averse to spending much time on this and I don't see a trivial solution from here which wouldn't involve ongoing busiwork. |
|
||
|
||
|
||
line(x, |
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 a stupid formatting change.
Wow, the output of autopep8 is not half bad. I've seen much worse in the past (though that was formatting a large C++ code base). Maybe I'm not so averse after all to enforcing autopep8 compliance via travis. (i.e, builds fail unless they comply). Re the stupid change, that could equally well be expressed a bit better, or we could change the (forced) line wrapping to, say, 100 rather than 80. |
I'm renaming the issue to "code formatting". |
The
This is what I get when running |
Let's do it. This is much less bad than I had in mind. |
There's a few remaining |
@cdeil, would you be willing to fix them? I'm a big fan of line length limits on the one hand, but I do think there are rare occasions where going over 80 is okay, so we could bump the warning length up to 80? |
Running the Eclipse PyDev code analysis on WebOOT gives these errors and warnings: https://gist.github.com/cdeil/5329975 There's a lot of false positives (e.g. all the |
s/80/100/ |
Okay, if you give me a list of real things I'll take a shot. |
The exact command used was: autopep8 -r weboot/ setup.py -i --max-line-length=100
weboot/utils/thousands.py:13:10: E711 comparison to None should be 'if cond is None:'
Hold off merging ... I'm manually fixing the 100+ character lines so that pep8 runs cleanly. |
@pwaller Please review. |
@cdeil, test failure due to corrupt tarfile. Does the code change when you run autopep8? i.e, is it feasible to run it automatically and it won't result in large code changes? |
The travis build error is a glitch because the ROOT tarball download didn't work. I re-triggered the build and it passed. |
okay, you can remove it. Actually you can remove the continue statement and everything below in that for loop. |
Could you also provide an autopep8 configuration and maybe a |
|
I was assuming you'd had to somehow feed some parameters to pep8. If not, then just |
I feed the parameters to pep8 and autopep8 on the command line. |
Wait ... let me add that to the travis build so that it fails on non-PEP8. :-) |
@pwaller Please review. |
Travis failed... looks like an old version of pep8? I'm very happy with this commit. We're good once travis is passing. |
One question, how to apply the diff that autopep8 spits out? |
Use the |
ah, so you'd recommend copying the command that |
The only reason I put And the travis build passes now that I pip-install an up-to-date version of the |
Great! 🍻 |
remove trailing whitespace in the code and educate developers how to never commit whitespace errors in the future, e.g. http://www.emacswiki.org/emacs/DeletingWhitespace#toc3