Skip to content

flake8 passes #1925

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

Merged
merged 5 commits into from
Feb 20, 2018
Merged

flake8 passes #1925

merged 5 commits into from
Feb 20, 2018

Conversation

max-sixty
Copy link
Collaborator

I was still getting stickler errors for code I hadn't changed. Flake8 should now pass

@@ -1,7 +1,7 @@
import xarray as xr
import numpy as np
import pandas as pd
import seaborn as sns # pandas aware plotting library
import seaborn as sns # pandas aware plotting library
Copy link
Contributor

Choose a reason for hiding this comment

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

F401 'seaborn as sns' imported but unused

@@ -27,7 +27,7 @@

p = air.plot(transform=ccrs.PlateCarree(), # the data's projection
col='time', col_wrap=1, # multiplot settings
aspect=ds.dims['lon']/ds.dims['lat'], # for a sensible figsize
aspect=ds.dims['lon'] / ds.dims['lat'], # for a sensible figsize
Copy link
Contributor

Choose a reason for hiding this comment

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

W1619 division w/o future statement

@max-sixty max-sixty mentioned this pull request Feb 20, 2018
@shoyer
Copy link
Member

shoyer commented Feb 20, 2018

Huh. I wonder how this got past our new CI tests for flake8.

@max-sixty
Copy link
Collaborator Author

It's v weird. If an ignore parameter is added, it generates the errors. This one on master:

# flake8  xarray                                                                                                         
-> passes

# flake8 --ignore=I002 xarray
xarray/plot/plot.py:762:47: E226 missing whitespace around arithmetic operator
xarray/plot/plot.py:764:47: E226 missing whitespace around arithmetic operator
xarray/backends/rasterio_.py:193:34: E226 missing whitespace around arithmetic operator
xarray/backends/rasterio_.py:193:52: E226 missing whitespace around arithmetic operator
xarray/backends/rasterio_.py:194:33: E226 missing whitespace around arithmetic operator
xarray/backends/rasterio_.py:194:52: E226 missing whitespace around arithmetic operator
xarray/tests/test_indexing.py:117:28: E241 multiple spaces after ','
xarray/tests/test_indexing.py:122:28: E241 multiple spaces after ','
xarray/tests/test_indexing.py:122:35: E241 multiple spaces after ','
xarray/tests/test_indexing.py:122:42: E241 multiple spaces after ','
xarray/tests/test_indexing.py:129:28: E241 multiple spaces after ','
xarray/tests/test_indexing.py:132:28: E241 multiple spaces after ','
xarray/tests/test_indexing.py:135:28: E241 multiple spaces after ','
xarray/tests/test_indexing.py:135:35: E241 multiple spaces after ','
xarray/tests/test_indexing.py:135:42: E241 multiple spaces after ','
xarray/tests/test_backends.py:2217:28: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2217:31: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2234:55: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2235:66: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2236:65: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2237:30: E126 continuation line over-indented for hanging indent
xarray/tests/test_backends.py:2319:36: E226 missing whitespace around arithmetic operator
xarray/tests/test_backends.py:2319:39: E226 missing whitespace around arithmetic operator
xarray/tests/test_duck_array_ops.py:21:31: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:21:37: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:21:43: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:22:31: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:22:37: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:22:43: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:23:30: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:23:36: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:23:42: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:25:31: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:25:37: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:25:43: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:26:31: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:26:37: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:26:43: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:27:31: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:27:37: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:27:43: E241 multiple spaces after ','
xarray/tests/test_duck_array_ops.py:290:42: E226 missing whitespace around arithmetic operator
xarray/tests/test_duck_array_ops.py:295:34: E226 missing whitespace around arithmetic operator

Identical results if --isolated is passed

@max-sixty
Copy link
Collaborator Author

Ah - problem solved - it's that there are some default ignores. So on adding an ignore, those are then picked up again.

@@ -6,3 +6,6 @@ python_files=test_*.py

[flake8]
max-line-length=79
ignore=I002
exclude=
doc/
Copy link
Member

Choose a reason for hiding this comment

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

Can you add this configuration to the .stickler.yml file, too? That will help keep things in sync.

See https://stickler-ci.com/docs#python

Copy link
Collaborator Author

@max-sixty max-sixty Feb 20, 2018

Choose a reason for hiding this comment

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

Good idea, done
(though ideally @stickler-ci you should read from standard configs...)

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this didn't actually work to ignore the doc directories -- see all the Stickler messages in #1930

@shoyer shoyer merged commit 97f5778 into pydata:master Feb 20, 2018
@shoyer
Copy link
Member

shoyer commented Feb 20, 2018

Thanks @maxim-lian

@max-sixty max-sixty deleted the flake8-v2 branch February 22, 2018 02:20
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.

3 participants