Permalink
Browse files

Change all references to the pep8 project to say pycodestyle

This fixes issue #518, pep8 still referenced in the cli help command
As a side effect, `[pep8]` in setup.cfg now becomes `[pycodestyle]`
Also, changed the path for the config file from ~/.config/pep8 to ~/.config/pycodestyle
These feel like changes that should have come with the jump to version 2.0.0, as they are breaking,
but support for  as a name can still be added if it's desired enough
  • Loading branch information...
1 parent b02d768 commit 26c64badd9ea27cbfbff311f7b3b09b475e80ead @iamaspacecow iamaspacecow committed Jun 2, 2016
Showing with 48 additions and 43 deletions.
  1. +11 −10 docs/intro.rst
  2. +5 −5 pycodestyle.py
  3. +1 −1 setup.cfg
  4. +1 −1 testsuite/test_api.py
  5. +4 −4 testsuite/test_parser.py
  6. +26 −22 testsuite/test_shell.py
View
@@ -167,13 +167,14 @@ Quick help is available on the command line::
--benchmark measure processing speed
Configuration:
- The project options are read from the [pep8] section of the tox.ini
- file or the setup.cfg file located in any parent folder of the path(s)
- being processed. Allowed options are: exclude, filename, select,
+ The project options are read from the [pycodestyle] section of the
+ tox.ini file or the setup.cfg file located in any parent folder of the
+ path(s) being processed. Allowed options are: exclude, filename, select,
ignore, max-line-length, hang-closing, count, format, quiet, show-pep8,
show-source, statistics, verbose.
- --config=path user config file location (default: ~/.config/pep8)
+ --config=path user config file location
+ (default: ~/.config/pycodestyle)
Configuration
@@ -184,23 +185,23 @@ The behaviour may be configured at two levels, the user and project levels.
At the user level, settings are read from the following locations:
If on Windows:
- ``~\.pep8``
+ ``~\.pycodestyle``
Otherwise, if the :envvar:`XDG_CONFIG_HOME` environment variable is defined:
- ``XDG_CONFIG_HOME/pep8``
+ ``XDG_CONFIG_HOME/pycodestyle``
Else if :envvar:`XDG_CONFIG_HOME` is not defined:
- ``~/.config/pep8``
+ ``~/.config/pycodestyle``
Example::
- [pep8]
+ [pycodestyle]
ignore = E226,E302,E41
max-line-length = 160
At the project level, a ``setup.cfg`` file or a ``tox.ini`` file is read if
-present. If none of these files have a ``[pep8]`` section, no project specific
-configuration is loaded.
+present. If none of these files have a ``[pycodestyle]`` section, no project
+specific configuration is loaded.
Error codes
View
@@ -70,11 +70,11 @@
DEFAULT_IGNORE = 'E121,E123,E126,E226,E24,E704,W503'
try:
if sys.platform == 'win32':
- USER_CONFIG = os.path.expanduser(r'~\.pep8')
+ USER_CONFIG = os.path.expanduser(r'~\.pycodestyle')
else:
USER_CONFIG = os.path.join(
os.getenv('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'),
- 'pep8'
+ 'pycodestyle'
)
except ImportError:
USER_CONFIG = None
@@ -1965,7 +1965,7 @@ def get_checks(self, argument_name):
return sorted(checks)
-def get_parser(prog='pep8', version=__version__):
+def get_parser(prog='pycodestyle', version=__version__):
"""Create the parser for the program."""
parser = OptionParser(prog=prog, version=version,
usage="%prog [options] input ...")
@@ -2033,7 +2033,7 @@ def read_config(options, args, arglist, parser):
If a config file is specified on the command line with the "--config"
option, then only it is used for configuration.
- Otherwise, the user configuration (~/.config/pep8) and any local
+ Otherwise, the user configuration (~/.config/pycodestyle) and any local
configurations in the current directory or above will be merged together
(in that order) using the read method of ConfigParser.
"""
@@ -2101,7 +2101,7 @@ def process_options(arglist=None, parse_argv=False, config_file=None,
"""Process options passed either via arglist or via command line args.
Passing in the ``config_file`` parameter allows other tools, such as flake8
- to specify their own options to be processed in pep8.
+ to specify their own options to be processed in pycodestyle.
"""
if not parser:
parser = get_parser()
View
@@ -1,7 +1,7 @@
[wheel]
universal = 1
-[pep8]
+[pycodestyle]
select =
ignore = E226,E24
max_line_length = 79
@@ -172,7 +172,7 @@ def test_styleguide_options(self):
def test_styleguide_ignore_code(self):
def parse_argv(argstring):
_saved_argv = sys.argv
- sys.argv = shlex.split('pep8 %s /dev/null' % argstring)
+ sys.argv = shlex.split('pycodestyle %s /dev/null' % argstring)
try:
return pycodestyle.StyleGuide(parse_argv=True)
finally:
@@ -19,7 +19,7 @@ class ParserTestCase(unittest.TestCase):
def test_vanilla_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore = E226,E24
"""
options, args = _process_file(contents)
@@ -28,7 +28,7 @@ def test_vanilla_ignore_parsing(self):
def test_multiline_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore =
E226,
E24
@@ -40,7 +40,7 @@ def test_multiline_ignore_parsing(self):
def test_trailing_comma_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore = E226,
"""
@@ -50,7 +50,7 @@ def test_trailing_comma_ignore_parsing(self):
def test_multiline_trailing_comma_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore =
E226,
E24,
@@ -19,7 +19,7 @@ def setUp(self):
self._saved_stdin_get_value = pycodestyle.stdin_get_value
self._config_filenames = []
self.stdin = ''
- sys.argv = ['pep8']
+ sys.argv = ['pycodestyle']
sys.stdout = PseudoFile()
sys.stderr = PseudoFile()
@@ -39,7 +39,7 @@ def tearDown(self):
def stdin_get_value(self):
return self.stdin
- def pep8(self, *args):
+ def pycodestyle(self, *args):
del sys.stdout[:], sys.stderr[:]
sys.argv[1:] = args
try:
@@ -50,28 +50,30 @@ def pep8(self, *args):
return sys.stdout.getvalue(), sys.stderr.getvalue(), errorcode
def test_print_usage(self):
- stdout, stderr, errcode = self.pep8('--help')
+ stdout, stderr, errcode = self.pycodestyle('--help')
self.assertFalse(errcode)
self.assertFalse(stderr)
- self.assertTrue(stdout.startswith("Usage: pep8 [options] input"))
+ self.assertTrue(stdout.startswith(
+ "Usage: pycodestyle [options] input"
+ ))
- stdout, stderr, errcode = self.pep8('--version')
+ stdout, stderr, errcode = self.pycodestyle('--version')
self.assertFalse(errcode)
self.assertFalse(stderr)
self.assertEqual(stdout.count('\n'), 1)
- stdout, stderr, errcode = self.pep8('--obfuscated')
+ stdout, stderr, errcode = self.pycodestyle('--obfuscated')
self.assertEqual(errcode, 2)
self.assertEqual(stderr.splitlines(),
- ["Usage: pep8 [options] input ...", "",
- "pep8: error: no such option: --obfuscated"])
+ ["Usage: pycodestyle [options] input ...", "",
+ "pycodestyle: error: no such option: --obfuscated"])
self.assertFalse(stdout)
self.assertFalse(self._config_filenames)
def test_check_simple(self):
E11 = os.path.join(ROOT_DIR, 'testsuite', 'E11.py')
- stdout, stderr, errcode = self.pep8(E11)
+ stdout, stderr, errcode = self.pycodestyle(E11)
stdout = stdout.splitlines()
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
@@ -82,20 +84,20 @@ def test_check_simple(self):
self.assertEqual(x, str(num))
self.assertEqual(y, str(col))
self.assertTrue(msg.startswith(' E11'))
- # Config file read from the pep8's setup.cfg
+ # Config file read from the pycodestyle's setup.cfg
config_filenames = [os.path.basename(p)
for p in self._config_filenames]
self.assertTrue('setup.cfg' in config_filenames)
def test_check_stdin(self):
pycodestyle.PROJECT_CONFIG = ()
- stdout, stderr, errcode = self.pep8('-')
+ stdout, stderr, errcode = self.pycodestyle('-')
self.assertFalse(errcode)
self.assertFalse(stderr)
self.assertFalse(stdout)
self.stdin = 'import os, sys\n'
- stdout, stderr, errcode = self.pep8('-')
+ stdout, stderr, errcode = self.pycodestyle('-')
stdout = stdout.splitlines()
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
@@ -104,19 +106,19 @@ def test_check_stdin(self):
def test_check_non_existent(self):
self.stdin = 'import os, sys\n'
- stdout, stderr, errcode = self.pep8('fictitious.py')
+ stdout, stderr, errcode = self.pycodestyle('fictitious.py')
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
self.assertTrue(stdout.startswith('fictitious.py:1:1: E902 '))
def test_check_noarg(self):
# issue #170: do not read stdin by default
pycodestyle.PROJECT_CONFIG = ()
- stdout, stderr, errcode = self.pep8()
+ stdout, stderr, errcode = self.pycodestyle()
self.assertEqual(errcode, 2)
self.assertEqual(stderr.splitlines(),
- ["Usage: pep8 [options] input ...", "",
- "pep8: error: input not specified"])
+ ["Usage: pycodestyle [options] input ...", "",
+ "pycodestyle: error: input not specified"])
self.assertFalse(self._config_filenames)
def test_check_diff(self):
@@ -136,7 +138,7 @@ def test_check_diff(self):
]
self.stdin = '\n'.join(diff_lines)
- stdout, stderr, errcode = self.pep8('--diff')
+ stdout, stderr, errcode = self.pycodestyle('--diff')
stdout = stdout.splitlines()
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
@@ -149,7 +151,7 @@ def test_check_diff(self):
diff_lines[:2] = ["--- a/testsuite/E11.py 2006-06-01 08:49 +0400",
"+++ b/testsuite/E11.py 2008-04-06 17:36 +0400"]
self.stdin = '\n'.join(diff_lines)
- stdout, stderr, errcode = self.pep8('--diff')
+ stdout, stderr, errcode = self.pycodestyle('--diff')
stdout = stdout.splitlines()
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
@@ -167,23 +169,25 @@ def test_check_diff(self):
"@@ -5,0 +6 @@ if True:",
"+ print"]
self.stdin = '\n'.join(diff_lines)
- stdout, stderr, errcode = self.pep8('--diff')
+ stdout, stderr, errcode = self.pycodestyle('--diff')
(stdout,) = stdout.splitlines()
self.assertEqual(errcode, 1)
self.assertFalse(stderr)
self.assertTrue('testsuite/E11.py:6:6: E111 ' in stdout)
# missing '--diff'
self.stdin = '\n'.join(diff_lines)
- stdout, stderr, errcode = self.pep8()
+ stdout, stderr, errcode = self.pycodestyle()
self.assertEqual(errcode, 2)
self.assertFalse(stdout)
- self.assertTrue(stderr.startswith('Usage: pep8 [options] input ...'))
+ self.assertTrue(stderr.startswith(
+ 'Usage: pycodestyle [options] input ...'
+ ))
# no matching file in the diff
diff_lines[3] = "+++ b/testsuite/lost/E11.py"
self.stdin = '\n'.join(diff_lines)
- stdout, stderr, errcode = self.pep8('--diff')
+ stdout, stderr, errcode = self.pycodestyle('--diff')
self.assertFalse(errcode)
self.assertFalse(stdout)
self.assertFalse(stderr)

0 comments on commit 26c64ba

Please sign in to comment.