summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2016-06-06 15:16:17 -0700
committerIan Lee <IanLee1521@gmail.com>2016-06-06 15:16:17 -0700
commit77f5543658dabdb939d65028ccaa743ca210c7c4 (patch)
treebeb66d04e460f12536935221dcc1dadec30bf8c3
parentb02d7687ee4de8f501195644bc9dc7fac523e52e (diff)
parent26c64badd9ea27cbfbff311f7b3b09b475e80ead (diff)
downloadpep8-77f5543658dabdb939d65028ccaa743ca210c7c4.tar.gz
Merge pull request #530 from iamaspacecow/pycodestyle-name-change
Change all references to the pep8 project to say pycodestyle
-rw-r--r--docs/intro.rst21
-rwxr-xr-xpycodestyle.py10
-rw-r--r--setup.cfg2
-rw-r--r--testsuite/test_api.py2
-rw-r--r--testsuite/test_parser.py8
-rw-r--r--testsuite/test_shell.py48
6 files changed, 48 insertions, 43 deletions
diff --git a/docs/intro.rst b/docs/intro.rst
index 12f67d7..ce71692 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -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
diff --git a/pycodestyle.py b/pycodestyle.py
index e52cfbd..df24911 100755
--- a/pycodestyle.py
+++ b/pycodestyle.py
@@ -70,11 +70,11 @@ DEFAULT_EXCLUDE = '.svn,CVS,.bzr,.hg,.git,__pycache__,.tox'
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 @@ class StyleGuide(object):
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()
diff --git a/setup.cfg b/setup.cfg
index 65ca96d..803bc10 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,7 +1,7 @@
[wheel]
universal = 1
-[pep8]
+[pycodestyle]
select =
ignore = E226,E24
max_line_length = 79
diff --git a/testsuite/test_api.py b/testsuite/test_api.py
index 6549a46..7d381ad 100644
--- a/testsuite/test_api.py
+++ b/testsuite/test_api.py
@@ -172,7 +172,7 @@ class APITestCase(unittest.TestCase):
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:
diff --git a/testsuite/test_parser.py b/testsuite/test_parser.py
index 26a45fc..0e54623 100644
--- a/testsuite/test_parser.py
+++ b/testsuite/test_parser.py
@@ -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 @@ ignore = E226,E24
def test_multiline_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore =
E226,
E24
@@ -40,7 +40,7 @@ ignore =
def test_trailing_comma_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore = E226,
"""
@@ -50,7 +50,7 @@ ignore = E226,
def test_multiline_trailing_comma_ignore_parsing(self):
contents = b"""
-[pep8]
+[pycodestyle]
ignore =
E226,
E24,
diff --git a/testsuite/test_shell.py b/testsuite/test_shell.py
index 760c228..a80c875 100644
--- a/testsuite/test_shell.py
+++ b/testsuite/test_shell.py
@@ -19,7 +19,7 @@ class ShellTestCase(unittest.TestCase):
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 @@ class ShellTestCase(unittest.TestCase):
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 @@ class ShellTestCase(unittest.TestCase):
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 @@ class ShellTestCase(unittest.TestCase):
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,7 +106,7 @@ class ShellTestCase(unittest.TestCase):
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 '))
@@ -112,11 +114,11 @@ class ShellTestCase(unittest.TestCase):
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 @@ class ShellTestCase(unittest.TestCase):
]
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 @@ class ShellTestCase(unittest.TestCase):
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,7 +169,7 @@ class ShellTestCase(unittest.TestCase):
"@@ -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)
@@ -175,15 +177,17 @@ class ShellTestCase(unittest.TestCase):
# 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)