Skip to content
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

Pep8 on many tests #2059

Merged
merged 4 commits into from Aug 17, 2013
Merged

Pep8 on many tests #2059

merged 4 commits into from Aug 17, 2013

Conversation

pelson
Copy link
Member

@pelson pelson commented May 24, 2013

No description provided.

@@ -93,16 +89,6 @@ def test_collection_transform_of_none():
assert isinstance(c._transOffset, mtrans.IdentityTransform)


def test_point_in_path():
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to test_path.py.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Over time, I'd like to move a lot of stuff out of test_axes as well so that no one file so dominates the run time.

@pelson
Copy link
Member Author

pelson commented May 24, 2013

@mdboom - if you happy, lets merge this and we can continue to keep up some momentum on PEP8 improvements.

[58230, 381139, 78045, 99308, 160454],
[89135, 80552, 152558, 497981, 603535],
[78415, 81858, 150656, 193263, 69638],
[139361, 331509, 343164, 781380, 52269]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a downgrade. Any way to ignore this kind of whitespace checking in the tool so we don't have to do things like this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. Each and every exception and line can be intercepted, and there may be a way to do inline markup to skip the checking, but in truth I don't necessarily agree that this is a downgrade. If you feel strongly about this we could pad the numbers with zeros?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't advocating inline markup -- I think that that would certainly be a downgrade. I was wondering if it would be possible to turn this whitespace check off globally since I generally think that extra whitespace before a literal or token like this can improve readability. Unfortunately, it doesn't look like one can do that effectively. The pep8 tool parses this as spaces after commas (and [ and whatever else), not spaces before literals, so it can't easily be turned off without letting through a bunch of other genuine problems. sigh. Maybe with some preprocessing this could be achieved. I just hate to throw out good violations of PEP8 because we want to eliminate bad violations elsewhere.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdboom, I agree entirely, and I think we need to resist the absolute tyranny of mechanical PEP8 checking, which is not consistent with PEP8 itself, or with good practice. The point is to make code maximally readable by humans.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize I'm being annoyingly late to this suggestion, having already merged the PEP8 test, but perhaps rather than failing on PEP8 violations we should just be tracking their total number. That's what we do on the astropy project, for example. If a particular large PR increases the number by a large amount, we address it, otherwise, there is always just some background of PEP8 violations we expect to have.

Another alternative might be to just turn off all whitespace-related checks in the automated checking, even though that will let some things through that are uncontroversially bad (such as function_call ( x ), for example. The other whitespace rule that I think is worthy of violating rather frequently is the grouping of operators for precedence, i.e. x + x**2. The fact that PEP8 doesn't encourage this is just a sign of its background in non-scientific programming, IMHO.

If this is becoming too much of a monster to get right, I propose we leave the pep8 test in, but comment out the assert statement that actually causes it to fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ignoring E226 takes care of the operator group issues and that is one of the default ignores.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of moving this PR forwards, I've reverted this change.

@mdboom
Copy link
Member

mdboom commented May 24, 2013

Sure -- I think this is mostly harmless. Some of this we may want to hold off on until after the feature freeze, though.

@pelson
Copy link
Member Author

pelson commented May 24, 2013

In case its hidden by github I commented:
For the sake of moving this PR forwards, I've reverted the indentation change.

@pelson
Copy link
Member Author

pelson commented May 28, 2013

Some of this we may want to hold off on until after the feature freeze, though.

I'm not sure I follow the logic here. Merging this into v1.3.x would mean that any future changes to these files will be done on top of this work - that will prevent any future conflicts, relating to PEP8, when merging v1.3.x and master.

@mdboom
Copy link
Member

mdboom commented May 28, 2013

The logic is that these changes are not strictly necessary (not really bug fixes), and they have the risk of introducing bugs. There have been other seemingly innocuous PEP8 changes that introduced bugs, and I would hate to inadvertently introduce more here this late in the game as well.

@dmcdougall
Copy link
Member

@pelson I think is fine to merge once you give it a rebase.

@NelleV
Copy link
Member

NelleV commented Jul 16, 2013

It would be nice to merge this. Can you try rebasing?

@dmcdougall dmcdougall merged commit 44b51ac into matplotlib:master Aug 17, 2013
@dmcdougall
Copy link
Member

Done. See 38e5eab. Tests on the conflicted files passed locally.

@pelson
Copy link
Member Author

pelson commented Aug 19, 2013

Cool. Thanks @dmcdougall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants