Skip to content

Commit 2fcec9a

Browse files
authored
Clean up pylint warnings in unit tests and update flake8 config (#152)
Adds short descriptions for all the ignored flake8 error codes. W291 (trailing whitespace) is no longer ignored and F401 (module imported but unused) is only ignored for __init__.py files.
1 parent 8601684 commit 2fcec9a

22 files changed

Lines changed: 66 additions & 74 deletions

File tree

.flake8

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
[flake8]
22
max-line-length = 132
3-
ignore = E126, E127, E128, E129, E226, E241, E265, E741, F401, F403, F841, W504, W291
4-
exclude = docs/,lm_combustion,radhydro
3+
4+
# E126: continuation line over-indented for hanging indent
5+
# E127: continuation line over-indented for visual indent
6+
# E128: continuation line under-indented for visual indent
7+
# E129: visually indented line with same indent as next logical line
8+
# E226: missing whitespace around arithmetic operator
9+
# E241: multiple spaces after ','
10+
# E265: block comment should start with '# '
11+
# E741: do not use variables named 'I', 'O', or 'l'
12+
# F403: 'from module import *' used; unable to detect undefined names
13+
# F841: local variable assigned to but never used
14+
# W504: line break after binary operator
15+
ignore = E126, E127, E128, E129, E226, E241, E265, E741, F403, F841, W504
16+
17+
# F401: module imported but unused
18+
per-file-ignores = __init__.py:F401
19+
20+
exclude = docs/

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ jobs:
4141
run: pip install .
4242

4343
- name: Validate
44-
run: pylint --errors-only pyro pyro/analysis
44+
run: pylint --errors-only pyro pyro/analysis pyro/**/tests/*.py
4545

logo/logo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
XXX XXX X XX
99
X X
1010
X X
11-
"""
11+
""" # noqa
1212

1313

1414
class LogoGrid:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ defining-attr-methods = [
3535
"__post_init__",
3636
"initialize",
3737
"__array_finalize__",
38+
"setup_class", "setup_method", # for tests
3839
]
3940

4041
[tool.pylint.FORMAT]

pyro/advection/tests/test_advection.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
from pyro.util import runparams
33

44

5-
class TestSimulation(object):
5+
class TestSimulation:
66
@classmethod
77
def setup_class(cls):
88
""" this is run once for each class before any tests """
9-
pass
109

1110
@classmethod
1211
def teardown_class(cls):
1312
""" this is run once for each class after all tests """
14-
pass
1513

1614
def setup_method(self):
1715
""" this is run before each test """

pyro/advection_nonuniform/tests/test_advection_nonuniform.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
from pyro.util import runparams
33

44

5-
class TestSimulation(object):
5+
class TestSimulation:
66
@classmethod
77
def setup_class(cls):
88
""" this is run once for each class before any tests """
9-
pass
109

1110
@classmethod
1211
def teardown_class(cls):
1312
""" this is run once for each class after all tests """
14-
pass
1513

1614
def setup_method(self):
1715
""" this is run before each test """

pyro/compressible/tests/test_compressible.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
from pyro.util import runparams
77

88

9-
class TestSimulation(object):
9+
class TestSimulation:
1010
@classmethod
1111
def setup_class(cls):
1212
""" this is run once for each class before any tests """
13-
pass
1413

1514
@classmethod
1615
def teardown_class(cls):
1716
""" this is run once for each class after all tests """
18-
pass
1917

2018
def setup_method(self):
2119
""" this is run before each test """

pyro/compressible/tests/test_eos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pyro.compressible.eos as eos
1+
from pyro.compressible import eos
22

33

44
def test_eos_consistency():

pyro/compressible_rk/tests/test_compressible_rk.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
from pyro.util import runparams
33

44

5-
class TestSimulation(object):
5+
class TestSimulation:
66
@classmethod
77
def setup_class(cls):
88
""" this is run once for each class before any tests """
9-
pass
109

1110
@classmethod
1211
def teardown_class(cls):
1312
""" this is run once for each class after all tests """
14-
pass
1513

1614
def setup_method(self):
1715
""" this is run before each test """

pyro/compressible_sr/tests/test_compressible_sr.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
from pyro.util import runparams
88

99

10-
class TestSimulation(object):
10+
class TestSimulation:
1111
@classmethod
1212
def setup_class(cls):
1313
""" this is run once for each class before any tests """
14-
pass
1514

1615
@classmethod
1716
def teardown_class(cls):
1817
""" this is run once for each class after all tests """
19-
pass
2018

2119
def setup_method(self):
2220
""" this is run before each test """

0 commit comments

Comments
 (0)