Skip to content

Commit 77f5543

Browse files
committed
Merge pull request #530 from iamaspacecow/pycodestyle-name-change
Change all references to the pep8 project to say pycodestyle
2 parents b02d768 + 26c64ba commit 77f5543

6 files changed

Lines changed: 48 additions & 43 deletions

File tree

docs/intro.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,14 @@ Quick help is available on the command line::
167167
--benchmark measure processing speed
168168

169169
Configuration:
170-
The project options are read from the [pep8] section of the tox.ini
171-
file or the setup.cfg file located in any parent folder of the path(s)
172-
being processed. Allowed options are: exclude, filename, select,
170+
The project options are read from the [pycodestyle] section of the
171+
tox.ini file or the setup.cfg file located in any parent folder of the
172+
path(s) being processed. Allowed options are: exclude, filename, select,
173173
ignore, max-line-length, hang-closing, count, format, quiet, show-pep8,
174174
show-source, statistics, verbose.
175175

176-
--config=path user config file location (default: ~/.config/pep8)
176+
--config=path user config file location
177+
(default: ~/.config/pycodestyle)
177178

178179

179180
Configuration
@@ -184,23 +185,23 @@ The behaviour may be configured at two levels, the user and project levels.
184185
At the user level, settings are read from the following locations:
185186

186187
If on Windows:
187-
``~\.pep8``
188+
``~\.pycodestyle``
188189

189190
Otherwise, if the :envvar:`XDG_CONFIG_HOME` environment variable is defined:
190-
``XDG_CONFIG_HOME/pep8``
191+
``XDG_CONFIG_HOME/pycodestyle``
191192

192193
Else if :envvar:`XDG_CONFIG_HOME` is not defined:
193-
``~/.config/pep8``
194+
``~/.config/pycodestyle``
194195

195196
Example::
196197

197-
[pep8]
198+
[pycodestyle]
198199
ignore = E226,E302,E41
199200
max-line-length = 160
200201

201202
At the project level, a ``setup.cfg`` file or a ``tox.ini`` file is read if
202-
present. If none of these files have a ``[pep8]`` section, no project specific
203-
configuration is loaded.
203+
present. If none of these files have a ``[pycodestyle]`` section, no project
204+
specific configuration is loaded.
204205

205206

206207
Error codes

pycodestyle.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503'
7171
try:
7272
if sys.platform == 'win32':
73-
USER_CONFIG = os.path.expanduser(r'~\.pep8')
73+
USER_CONFIG = os.path.expanduser(r'~\.pycodestyle')
7474
else:
7575
USER_CONFIG = os.path.join(
7676
os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
77-
'pep8'
77+
'pycodestyle'
7878
)
7979
except ImportError:
8080
USER_CONFIG = None
@@ -1965,7 +1965,7 @@ def get_checks(self, argument_name):
19651965
return sorted(checks)
19661966

19671967

1968-
def get_parser(prog='pep8', version=__version__):
1968+
def get_parser(prog='pycodestyle', version=__version__):
19691969
"""Create the parser for the program."""
19701970
parser = OptionParser(prog=prog, version=version,
19711971
usage="%prog [options] input ...")
@@ -2033,7 +2033,7 @@ def read_config(options, args, arglist, parser):
20332033
If a config file is specified on the command line with the "--config"
20342034
option, then only it is used for configuration.
20352035
2036-
Otherwise, the user configuration (~/.config/pep8) and any local
2036+
Otherwise, the user configuration (~/.config/pycodestyle) and any local
20372037
configurations in the current directory or above will be merged together
20382038
(in that order) using the read method of ConfigParser.
20392039
"""
@@ -2101,7 +2101,7 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
21012101
"""Process options passed either via arglist or via command line args.
21022102
21032103
Passing in the ``config_file`` parameter allows other tools, such as flake8
2104-
to specify their own options to be processed in pep8.
2104+
to specify their own options to be processed in pycodestyle.
21052105
"""
21062106
if not parser:
21072107
parser = get_parser()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[wheel]
22
universal = 1
33

4-
[pep8]
4+
[pycodestyle]
55
select =
66
ignore = E226,E24
77
max_line_length = 79

testsuite/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def test_styleguide_options(self):
172172
def test_styleguide_ignore_code(self):
173173
def parse_argv(argstring):
174174
_saved_argv = sys.argv
175-
sys.argv = shlex.split('pep8 %s /dev/null' % argstring)
175+
sys.argv = shlex.split('pycodestyle %s /dev/null' % argstring)
176176
try:
177177
return pycodestyle.StyleGuide(parse_argv=True)
178178
finally:

testsuite/test_parser.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ParserTestCase(unittest.TestCase):
1919

2020
def test_vanilla_ignore_parsing(self):
2121
contents = b"""
22-
[pep8]
22+
[pycodestyle]
2323
ignore = E226,E24
2424
"""
2525
options, args = _process_file(contents)
@@ -28,7 +28,7 @@ def test_vanilla_ignore_parsing(self):
2828

2929
def test_multiline_ignore_parsing(self):
3030
contents = b"""
31-
[pep8]
31+
[pycodestyle]
3232
ignore =
3333
E226,
3434
E24
@@ -40,7 +40,7 @@ def test_multiline_ignore_parsing(self):
4040

4141
def test_trailing_comma_ignore_parsing(self):
4242
contents = b"""
43-
[pep8]
43+
[pycodestyle]
4444
ignore = E226,
4545
"""
4646

@@ -50,7 +50,7 @@ def test_trailing_comma_ignore_parsing(self):
5050

5151
def test_multiline_trailing_comma_ignore_parsing(self):
5252
contents = b"""
53-
[pep8]
53+
[pycodestyle]
5454
ignore =
5555
E226,
5656
E24,

testsuite/test_shell.py

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def setUp(self):
1919
self._saved_stdin_get_value = pycodestyle.stdin_get_value
2020
self._config_filenames = []
2121
self.stdin = ''
22-
sys.argv = ['pep8']
22+
sys.argv = ['pycodestyle']
2323
sys.stdout = PseudoFile()
2424
sys.stderr = PseudoFile()
2525

@@ -39,7 +39,7 @@ def tearDown(self):
3939
def stdin_get_value(self):
4040
return self.stdin
4141

42-
def pep8(self, *args):
42+
def pycodestyle(self, *args):
4343
del sys.stdout[:], sys.stderr[:]
4444
sys.argv[1:] = args
4545
try:
@@ -50,28 +50,30 @@ def pep8(self, *args):
5050
return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
5151

5252
def test_print_usage(self):
53-
stdout, stderr, errcode = self.pep8('--help')
53+
stdout, stderr, errcode = self.pycodestyle('--help')
5454
self.assertFalse(errcode)
5555
self.assertFalse(stderr)
56-
self.assertTrue(stdout.startswith("Usage: pep8 [options] input"))
56+
self.assertTrue(stdout.startswith(
57+
"Usage: pycodestyle [options] input"
58+
))
5759

58-
stdout, stderr, errcode = self.pep8('--version')
60+
stdout, stderr, errcode = self.pycodestyle('--version')
5961
self.assertFalse(errcode)
6062
self.assertFalse(stderr)
6163
self.assertEqual(stdout.count('\n'), 1)
6264

63-
stdout, stderr, errcode = self.pep8('--obfuscated')
65+
stdout, stderr, errcode = self.pycodestyle('--obfuscated')
6466
self.assertEqual(errcode, 2)
6567
self.assertEqual(stderr.splitlines(),
66-
["Usage: pep8 [options] input ...", "",
67-
"pep8: error: no such option: --obfuscated"])
68+
["Usage: pycodestyle [options] input ...", "",
69+
"pycodestyle: error: no such option: --obfuscated"])
6870
self.assertFalse(stdout)
6971

7072
self.assertFalse(self._config_filenames)
7173

7274
def test_check_simple(self):
7375
E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
74-
stdout, stderr, errcode = self.pep8(E11)
76+
stdout, stderr, errcode = self.pycodestyle(E11)
7577
stdout = stdout.splitlines()
7678
self.assertEqual(errcode, 1)
7779
self.assertFalse(stderr)
@@ -82,20 +84,20 @@ def test_check_simple(self):
8284
self.assertEqual(x, str(num))
8385
self.assertEqual(y, str(col))
8486
self.assertTrue(msg.startswith(' E11'))
85-
# Config file read from the pep8's setup.cfg
87+
# Config file read from the pycodestyle's setup.cfg
8688
config_filenames = [os.path.basename(p)
8789
for p in self._config_filenames]
8890
self.assertTrue('setup.cfg' in config_filenames)
8991

9092
def test_check_stdin(self):
9193
pycodestyle.PROJECT_CONFIG = ()
92-
stdout, stderr, errcode = self.pep8('-')
94+
stdout, stderr, errcode = self.pycodestyle('-')
9395
self.assertFalse(errcode)
9496
self.assertFalse(stderr)
9597
self.assertFalse(stdout)
9698

9799
self.stdin = 'import os, sys\n'
98-
stdout, stderr, errcode = self.pep8('-')
100+
stdout, stderr, errcode = self.pycodestyle('-')
99101
stdout = stdout.splitlines()
100102
self.assertEqual(errcode, 1)
101103
self.assertFalse(stderr)
@@ -104,19 +106,19 @@ def test_check_stdin(self):
104106

105107
def test_check_non_existent(self):
106108
self.stdin = 'import os, sys\n'
107-
stdout, stderr, errcode = self.pep8('fictitious.py')
109+
stdout, stderr, errcode = self.pycodestyle('fictitious.py')
108110
self.assertEqual(errcode, 1)
109111
self.assertFalse(stderr)
110112
self.assertTrue(stdout.startswith('fictitious.py:1:1: E902 '))
111113

112114
def test_check_noarg(self):
113115
# issue #170: do not read stdin by default
114116
pycodestyle.PROJECT_CONFIG = ()
115-
stdout, stderr, errcode = self.pep8()
117+
stdout, stderr, errcode = self.pycodestyle()
116118
self.assertEqual(errcode, 2)
117119
self.assertEqual(stderr.splitlines(),
118-
["Usage: pep8 [options] input ...", "",
119-
"pep8: error: input not specified"])
120+
["Usage: pycodestyle [options] input ...", "",
121+
"pycodestyle: error: input not specified"])
120122
self.assertFalse(self._config_filenames)
121123

122124
def test_check_diff(self):
@@ -136,7 +138,7 @@ def test_check_diff(self):
136138
]
137139

138140
self.stdin = '\n'.join(diff_lines)
139-
stdout, stderr, errcode = self.pep8('--diff')
141+
stdout, stderr, errcode = self.pycodestyle('--diff')
140142
stdout = stdout.splitlines()
141143
self.assertEqual(errcode, 1)
142144
self.assertFalse(stderr)
@@ -149,7 +151,7 @@ def test_check_diff(self):
149151
diff_lines[:2] = ["--- a/testsuite/E11.py 2006-06-01 08:49 +0400",
150152
"+++ b/testsuite/E11.py 2008-04-06 17:36 +0400"]
151153
self.stdin = '\n'.join(diff_lines)
152-
stdout, stderr, errcode = self.pep8('--diff')
154+
stdout, stderr, errcode = self.pycodestyle('--diff')
153155
stdout = stdout.splitlines()
154156
self.assertEqual(errcode, 1)
155157
self.assertFalse(stderr)
@@ -167,23 +169,25 @@ def test_check_diff(self):
167169
"@@ -5,0 +6 @@ if True:",
168170
"+ print"]
169171
self.stdin = '\n'.join(diff_lines)
170-
stdout, stderr, errcode = self.pep8('--diff')
172+
stdout, stderr, errcode = self.pycodestyle('--diff')
171173
(stdout,) = stdout.splitlines()
172174
self.assertEqual(errcode, 1)
173175
self.assertFalse(stderr)
174176
self.assertTrue('testsuite/E11.py:6:6: E111 ' in stdout)
175177

176178
# missing '--diff'
177179
self.stdin = '\n'.join(diff_lines)
178-
stdout, stderr, errcode = self.pep8()
180+
stdout, stderr, errcode = self.pycodestyle()
179181
self.assertEqual(errcode, 2)
180182
self.assertFalse(stdout)
181-
self.assertTrue(stderr.startswith('Usage: pep8 [options] input ...'))
183+
self.assertTrue(stderr.startswith(
184+
'Usage: pycodestyle [options] input ...'
185+
))
182186

183187
# no matching file in the diff
184188
diff_lines[3] = "+++ b/testsuite/lost/E11.py"
185189
self.stdin = '\n'.join(diff_lines)
186-
stdout, stderr, errcode = self.pep8('--diff')
190+
stdout, stderr, errcode = self.pycodestyle('--diff')
187191
self.assertFalse(errcode)
188192
self.assertFalse(stdout)
189193
self.assertFalse(stderr)

0 commit comments

Comments
 (0)