diff options
-rw-r--r-- | docs/advanced.rst | 2 | ||||
-rw-r--r-- | docs/conf.py | 6 | ||||
-rw-r--r-- | docs/developer.rst | 8 | ||||
-rw-r--r-- | docs/index.rst | 2 | ||||
-rw-r--r-- | docs/intro.rst | 382 | ||||
-rwxr-xr-x | pep8.py | 33 | ||||
-rw-r--r-- | testsuite/test_all.py | 3 | ||||
-rw-r--r-- | testsuite/test_parser.py | 61 |
8 files changed, 292 insertions, 205 deletions
diff --git a/docs/advanced.rst b/docs/advanced.rst index 2bce2e0..1c3a7e1 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -42,7 +42,7 @@ Skip file header ---------------- Another example is related to the `feature request #143 -<https://github.com/jcrocholl/pep8/issues/143>`_: skip a number of lines +<https://github.com/pycqa/pep8/issues/143>`_: skip a number of lines at the beginning and the end of a file. This use case is easy to implement through a custom wrapper for the PEP 8 library:: diff --git a/docs/conf.py b/docs/conf.py index 78bd344..d58549d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -99,7 +99,11 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' +if not on_rtd: # only import and set the theme if we're building docs locally + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/developer.rst b/docs/developer.rst index 4725acd..9db13b1 100644 --- a/docs/developer.rst +++ b/docs/developer.rst @@ -11,13 +11,13 @@ Source code The source code is currently `available on GitHub`_ under the terms and conditions of the :ref:`Expat license <license>`. Fork away! -* `Source code <https://github.com/jcrocholl/pep8>`_ and - `issue tracker <https://github.com/jcrocholl/pep8/issues>`_ on GitHub. -* `Continuous tests <http://travis-ci.org/jcrocholl/pep8>`_ against Python +* `Source code <https://github.com/pycqa/pep8>`_ and + `issue tracker <https://github.com/pycqa/pep8/issues>`_ on GitHub. +* `Continuous tests <http://travis-ci.org/pycqa/pep8>`_ against Python 2.6 through 3.4 and PyPy, on `Travis-CI platform <http://about.travis-ci.org/>`_. -.. _available on GitHub: https://github.com/jcrocholl/pep8 +.. _available on GitHub: https://github.com/pycqa/pep8 Contribute diff --git a/docs/index.rst b/docs/index.rst index 5500e0d..5e4a4c5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,7 +22,7 @@ Contents: developer * Online documentation: http://pep8.readthedocs.org/ -* Source code and issue tracker: https://github.com/jcrocholl/pep8 +* Source code and issue tracker: https://github.com/pycqa/pep8 Indices and tables diff --git a/docs/intro.rst b/docs/intro.rst index 141463c..3a605eb 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -217,196 +217,196 @@ Error codes This is the current list of error and warning codes: -+----------+----------------------------------------------------------------------+ -| code | sample message | -+==========+======================================================================+ -| **E1** | *Indentation* | -+----------+----------------------------------------------------------------------+ -| E101 | indentation contains mixed spaces and tabs | -+----------+----------------------------------------------------------------------+ -| E111 | indentation is not a multiple of four | -+----------+----------------------------------------------------------------------+ -| E112 | expected an indented block | -+----------+----------------------------------------------------------------------+ -| E113 | unexpected indentation | -+----------+----------------------------------------------------------------------+ -| E114 | indentation is not a multiple of four (comment) | -+----------+----------------------------------------------------------------------+ -| E115 | expected an indented block (comment) | -+----------+----------------------------------------------------------------------+ -| E116 | unexpected indentation (comment) | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E121 (*^)| continuation line under-indented for hanging indent | -+----------+----------------------------------------------------------------------+ -| E122 (^) | continuation line missing indentation or outdented | -+----------+----------------------------------------------------------------------+ -| E123 (*) | closing bracket does not match indentation of opening bracket's line | -+----------+----------------------------------------------------------------------+ -| E124 (^) | closing bracket does not match visual indentation | -+----------+----------------------------------------------------------------------+ -| E125 (^) | continuation line with same indent as next logical line | -+----------+----------------------------------------------------------------------+ -| E126 (*^)| continuation line over-indented for hanging indent | -+----------+----------------------------------------------------------------------+ -| E127 (^) | continuation line over-indented for visual indent | -+----------+----------------------------------------------------------------------+ -| E128 (^) | continuation line under-indented for visual indent | -+----------+----------------------------------------------------------------------+ -| E129 (^) | visually indented line with same indent as next logical line | -+----------+----------------------------------------------------------------------+ -| E131 (^) | continuation line unaligned for hanging indent | -+----------+----------------------------------------------------------------------+ -| E133 (*) | closing bracket is missing indentation | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E2** | *Whitespace* | -+----------+----------------------------------------------------------------------+ -| E201 | whitespace after '(' | -+----------+----------------------------------------------------------------------+ -| E202 | whitespace before ')' | -+----------+----------------------------------------------------------------------+ -| E203 | whitespace before ':' | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E211 | whitespace before '(' | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E221 | multiple spaces before operator | -+----------+----------------------------------------------------------------------+ -| E222 | multiple spaces after operator | -+----------+----------------------------------------------------------------------+ -| E223 | tab before operator | -+----------+----------------------------------------------------------------------+ -| E224 | tab after operator | -+----------+----------------------------------------------------------------------+ -| E225 | missing whitespace around operator | -+----------+----------------------------------------------------------------------+ -| E226 (*) | missing whitespace around arithmetic operator | -+----------+----------------------------------------------------------------------+ -| E227 | missing whitespace around bitwise or shift operator | -+----------+----------------------------------------------------------------------+ -| E228 | missing whitespace around modulo operator | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E231 | missing whitespace after ',', ';', or ':' | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E241 (*) | multiple spaces after ',' | -+----------+----------------------------------------------------------------------+ -| E242 (*) | tab after ',' | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E251 | unexpected spaces around keyword / parameter equals | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E261 | at least two spaces before inline comment | -+----------+----------------------------------------------------------------------+ -| E262 | inline comment should start with '# ' | -+----------+----------------------------------------------------------------------+ -| E265 | block comment should start with '# ' | -+----------+----------------------------------------------------------------------+ -| E266 | too many leading '#' for block comment | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| E271 | multiple spaces after keyword | -+----------+----------------------------------------------------------------------+ -| E272 | multiple spaces before keyword | -+----------+----------------------------------------------------------------------+ -| E273 | tab after keyword | -+----------+----------------------------------------------------------------------+ -| E274 | tab before keyword | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E3** | *Blank line* | -+----------+----------------------------------------------------------------------+ -| E301 | expected 1 blank line, found 0 | -+----------+----------------------------------------------------------------------+ -| E302 | expected 2 blank lines, found 0 | -+----------+----------------------------------------------------------------------+ -| E303 | too many blank lines (3) | -+----------+----------------------------------------------------------------------+ -| E304 | blank lines found after function decorator | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E4** | *Import* | -+----------+----------------------------------------------------------------------+ -| E401 | multiple imports on one line | -+----------+----------------------------------------------------------------------+ -| E402 | module level import not at top of file | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E5** | *Line length* | -+----------+----------------------------------------------------------------------+ -| E501 (^) | line too long (82 > 79 characters) | -+----------+----------------------------------------------------------------------+ -| E502 | the backslash is redundant between brackets | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E7** | *Statement* | -+----------+----------------------------------------------------------------------+ -| E701 | multiple statements on one line (colon) | -+----------+----------------------------------------------------------------------+ -| E702 | multiple statements on one line (semicolon) | -+----------+----------------------------------------------------------------------+ -| E703 | statement ends with a semicolon | -+----------+----------------------------------------------------------------------+ -| E704 (*) | multiple statements on one line (def) | -+----------+----------------------------------------------------------------------+ -| E711 (^) | comparison to None should be 'if cond is None:' | -+----------+----------------------------------------------------------------------+ -| E712 (^) | comparison to True should be 'if cond is True:' or 'if cond:' | -+----------+----------------------------------------------------------------------+ -| E713 | test for membership should be 'not in' | -+----------+----------------------------------------------------------------------+ -| E714 | test for object identity should be 'is not' | -+----------+----------------------------------------------------------------------+ -| E721 (^) | do not compare types, use 'isinstance()' | -+----------+----------------------------------------------------------------------+ -| E731 | do not assign a lambda expression, use a def | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **E9** | *Runtime* | -+----------+----------------------------------------------------------------------+ -| E901 | SyntaxError or IndentationError | -+----------+----------------------------------------------------------------------+ -| E902 | IOError | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **W1** | *Indentation warning* | -+----------+----------------------------------------------------------------------+ -| W191 | indentation contains tabs | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **W2** | *Whitespace warning* | -+----------+----------------------------------------------------------------------+ -| W291 | trailing whitespace | -+----------+----------------------------------------------------------------------+ -| W292 | no newline at end of file | -+----------+----------------------------------------------------------------------+ -| W293 | blank line contains whitespace | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **W3** | *Blank line warning* | -+----------+----------------------------------------------------------------------+ -| W391 | blank line at end of file | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **W5** | *Line break warning* | -+----------+----------------------------------------------------------------------+ -| W503 | line break occurred before a binary operator | -+----------+----------------------------------------------------------------------+ -+----------+----------------------------------------------------------------------+ -| **W6** | *Deprecation warning* | -+----------+----------------------------------------------------------------------+ -| W601 | .has_key() is deprecated, use 'in' | -+----------+----------------------------------------------------------------------+ -| W602 | deprecated form of raising exception | -+----------+----------------------------------------------------------------------+ -| W603 | '<>' is deprecated, use '!=' | -+----------+----------------------------------------------------------------------+ -| W604 | backticks are deprecated, use 'repr()' | -+----------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| code | sample message | ++============+======================================================================+ +| **E1** | *Indentation* | ++------------+----------------------------------------------------------------------+ +| E101 | indentation contains mixed spaces and tabs | ++------------+----------------------------------------------------------------------+ +| E111 | indentation is not a multiple of four | ++------------+----------------------------------------------------------------------+ +| E112 | expected an indented block | ++------------+----------------------------------------------------------------------+ +| E113 | unexpected indentation | ++------------+----------------------------------------------------------------------+ +| E114 | indentation is not a multiple of four (comment) | ++------------+----------------------------------------------------------------------+ +| E115 | expected an indented block (comment) | ++------------+----------------------------------------------------------------------+ +| E116 | unexpected indentation (comment) | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E121 (\*^) | continuation line under-indented for hanging indent | ++------------+----------------------------------------------------------------------+ +| E122 (^) | continuation line missing indentation or outdented | ++------------+----------------------------------------------------------------------+ +| E123 (*) | closing bracket does not match indentation of opening bracket's line | ++------------+----------------------------------------------------------------------+ +| E124 (^) | closing bracket does not match visual indentation | ++------------+----------------------------------------------------------------------+ +| E125 (^) | continuation line with same indent as next logical line | ++------------+----------------------------------------------------------------------+ +| E126 (\*^) | continuation line over-indented for hanging indent | ++------------+----------------------------------------------------------------------+ +| E127 (^) | continuation line over-indented for visual indent | ++------------+----------------------------------------------------------------------+ +| E128 (^) | continuation line under-indented for visual indent | ++------------+----------------------------------------------------------------------+ +| E129 (^) | visually indented line with same indent as next logical line | ++------------+----------------------------------------------------------------------+ +| E131 (^) | continuation line unaligned for hanging indent | ++------------+----------------------------------------------------------------------+ +| E133 (*) | closing bracket is missing indentation | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E2** | *Whitespace* | ++------------+----------------------------------------------------------------------+ +| E201 | whitespace after '(' | ++------------+----------------------------------------------------------------------+ +| E202 | whitespace before ')' | ++------------+----------------------------------------------------------------------+ +| E203 | whitespace before ':' | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E211 | whitespace before '(' | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E221 | multiple spaces before operator | ++------------+----------------------------------------------------------------------+ +| E222 | multiple spaces after operator | ++------------+----------------------------------------------------------------------+ +| E223 | tab before operator | ++------------+----------------------------------------------------------------------+ +| E224 | tab after operator | ++------------+----------------------------------------------------------------------+ +| E225 | missing whitespace around operator | ++------------+----------------------------------------------------------------------+ +| E226 (*) | missing whitespace around arithmetic operator | ++------------+----------------------------------------------------------------------+ +| E227 | missing whitespace around bitwise or shift operator | ++------------+----------------------------------------------------------------------+ +| E228 | missing whitespace around modulo operator | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E231 | missing whitespace after ',', ';', or ':' | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E241 (*) | multiple spaces after ',' | ++------------+----------------------------------------------------------------------+ +| E242 (*) | tab after ',' | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E251 | unexpected spaces around keyword / parameter equals | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E261 | at least two spaces before inline comment | ++------------+----------------------------------------------------------------------+ +| E262 | inline comment should start with '# ' | ++------------+----------------------------------------------------------------------+ +| E265 | block comment should start with '# ' | ++------------+----------------------------------------------------------------------+ +| E266 | too many leading '#' for block comment | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| E271 | multiple spaces after keyword | ++------------+----------------------------------------------------------------------+ +| E272 | multiple spaces before keyword | ++------------+----------------------------------------------------------------------+ +| E273 | tab after keyword | ++------------+----------------------------------------------------------------------+ +| E274 | tab before keyword | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E3** | *Blank line* | ++------------+----------------------------------------------------------------------+ +| E301 | expected 1 blank line, found 0 | ++------------+----------------------------------------------------------------------+ +| E302 | expected 2 blank lines, found 0 | ++------------+----------------------------------------------------------------------+ +| E303 | too many blank lines (3) | ++------------+----------------------------------------------------------------------+ +| E304 | blank lines found after function decorator | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E4** | *Import* | ++------------+----------------------------------------------------------------------+ +| E401 | multiple imports on one line | ++------------+----------------------------------------------------------------------+ +| E402 | module level import not at top of file | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E5** | *Line length* | ++------------+----------------------------------------------------------------------+ +| E501 (^) | line too long (82 > 79 characters) | ++------------+----------------------------------------------------------------------+ +| E502 | the backslash is redundant between brackets | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E7** | *Statement* | ++------------+----------------------------------------------------------------------+ +| E701 | multiple statements on one line (colon) | ++------------+----------------------------------------------------------------------+ +| E702 | multiple statements on one line (semicolon) | ++------------+----------------------------------------------------------------------+ +| E703 | statement ends with a semicolon | ++------------+----------------------------------------------------------------------+ +| E704 (*) | multiple statements on one line (def) | ++------------+----------------------------------------------------------------------+ +| E711 (^) | comparison to None should be 'if cond is None:' | ++------------+----------------------------------------------------------------------+ +| E712 (^) | comparison to True should be 'if cond is True:' or 'if cond:' | ++------------+----------------------------------------------------------------------+ +| E713 | test for membership should be 'not in' | ++------------+----------------------------------------------------------------------+ +| E714 | test for object identity should be 'is not' | ++------------+----------------------------------------------------------------------+ +| E721 (^) | do not compare types, use 'isinstance()' | ++------------+----------------------------------------------------------------------+ +| E731 | do not assign a lambda expression, use a def | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **E9** | *Runtime* | ++------------+----------------------------------------------------------------------+ +| E901 | SyntaxError or IndentationError | ++------------+----------------------------------------------------------------------+ +| E902 | IOError | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **W1** | *Indentation warning* | ++------------+----------------------------------------------------------------------+ +| W191 | indentation contains tabs | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **W2** | *Whitespace warning* | ++------------+----------------------------------------------------------------------+ +| W291 | trailing whitespace | ++------------+----------------------------------------------------------------------+ +| W292 | no newline at end of file | ++------------+----------------------------------------------------------------------+ +| W293 | blank line contains whitespace | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **W3** | *Blank line warning* | ++------------+----------------------------------------------------------------------+ +| W391 | blank line at end of file | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **W5** | *Line break warning* | ++------------+----------------------------------------------------------------------+ +| W503 | line break occurred before a binary operator | ++------------+----------------------------------------------------------------------+ ++------------+----------------------------------------------------------------------+ +| **W6** | *Deprecation warning* | ++------------+----------------------------------------------------------------------+ +| W601 | .has_key() is deprecated, use 'in' | ++------------+----------------------------------------------------------------------+ +| W602 | deprecated form of raising exception | ++------------+----------------------------------------------------------------------+ +| W603 | '<>' is deprecated, use '!=' | ++------------+----------------------------------------------------------------------+ +| W604 | backticks are deprecated, use 'repr()' | ++------------+----------------------------------------------------------------------+ **(*)** In the default configuration, the checks **E121**, **E123**, **E126**, @@ -435,6 +435,6 @@ The `flake8 checker <https://flake8.readthedocs.org>`_ is a wrapper around ``pep8`` and similar tools. It supports plugins. Other tools which use ``pep8`` are referenced in the Wiki: `list of related -tools <https://github.com/jcrocholl/pep8/wiki/RelatedTools>`_. +tools <https://github.com/pycqa/pep8/wiki/RelatedTools>`_. .. _PEP 8: http://www.python.org/dev/peps/pep-0008/ @@ -31,7 +31,7 @@ For usage and a list of options, try this: $ python pep8.py -h This program and its regression test suite live here: -http://github.com/jcrocholl/pep8 +https://github.com/pycqa/pep8 Groups of errors and warnings: E errors @@ -1962,8 +1962,8 @@ def get_parser(prog='pep8', version=__version__): parser.add_option('--format', metavar='format', default='default', help="set the error format [default|pylint|<custom>]") parser.add_option('--diff', action='store_true', - help="report only lines changed according to the " - "unified diff received on STDIN") + help="report changes only within line number ranges in " + "the unified diff received on STDIN") group = parser.add_option_group("Testing Options") if os.path.exists(TESTSUITE_PATH): group.add_option('--testsuite', metavar='dir', @@ -2081,10 +2081,10 @@ def process_options(arglist=None, parse_argv=False, config_file=None, options = read_config(options, args, arglist, parser) options.reporter = parse_argv and options.quiet == 1 and FileReport - options.filename = options.filename and options.filename.split(',') + options.filename = _parse_multi_options(options.filename) options.exclude = normalize_paths(options.exclude) - options.select = options.select and options.select.split(',') - options.ignore = options.ignore and options.ignore.split(',') + options.select = _parse_multi_options(options.select) + options.ignore = _parse_multi_options(options.ignore) if options.diff: options.reporter = DiffReport @@ -2095,6 +2095,22 @@ def process_options(arglist=None, parse_argv=False, config_file=None, return options, args +def _parse_multi_options(options, split_token=','): + r"""Split and strip and discard empties. + + Turns the following: + + A, + B, + + into ["A", "B"] + """ + if options: + return [o.strip() for o in options.split(split_token) if o.strip()] + else: + return options + + def _main(): """Parse options and run checks on Python source.""" import signal @@ -2107,17 +2123,22 @@ def _main(): pep8style = StyleGuide(parse_argv=True) options = pep8style.options + if options.doctest or options.testsuite: from testsuite.support import run_tests report = run_tests(pep8style) else: report = pep8style.check_files() + if options.statistics: report.print_statistics() + if options.benchmark: report.print_benchmark() + if options.testsuite and not options.quiet: report.print_results() + if report.total_errors: if options.count: sys.stderr.write(str(report.total_errors) + '\n') diff --git a/testsuite/test_all.py b/testsuite/test_all.py index 50e2cb9..bfb61d5 100644 --- a/testsuite/test_all.py +++ b/testsuite/test_all.py @@ -46,11 +46,12 @@ class Pep8TestCase(unittest.TestCase): def suite(): - from testsuite import test_api, test_shell, test_util + from testsuite import test_api, test_parser, test_shell, test_util suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(Pep8TestCase)) suite.addTest(unittest.makeSuite(test_api.APITestCase)) + suite.addTest(unittest.makeSuite(test_parser.ParserTestCase)) suite.addTest(unittest.makeSuite(test_shell.ShellTestCase)) suite.addTest(unittest.makeSuite(test_util.UtilTestCase)) return suite diff --git a/testsuite/test_parser.py b/testsuite/test_parser.py new file mode 100644 index 0000000..1d9e1ac --- /dev/null +++ b/testsuite/test_parser.py @@ -0,0 +1,61 @@ +import os +import tempfile +import unittest + +import pep8 + + +def _process_file(contents): + with tempfile.NamedTemporaryFile(delete=False) as f: + f.write(contents) + + options, args = pep8.process_options(config_file=f.name) + os.remove(f.name) + + return options, args + + +class ParserTestCase(unittest.TestCase): + + def test_vanilla_ignore_parsing(self): + contents = b""" +[pep8] +ignore = E226,E24 + """ + options, args = _process_file(contents) + + self.assertEqual(options.ignore, ["E226", "E24"]) + + def test_multiline_ignore_parsing(self): + contents = b""" +[pep8] +ignore = + E226, + E24 + """ + + options, args = _process_file(contents) + + self.assertEqual(options.ignore, ["E226", "E24"]) + + def test_trailing_comma_ignore_parsing(self): + contents = b""" +[pep8] +ignore = E226, + """ + + options, args = _process_file(contents) + + self.assertEqual(options.ignore, ["E226"]) + + def test_multiline_trailing_comma_ignore_parsing(self): + contents = b""" +[pep8] +ignore = + E226, + E24, + """ + + options, args = _process_file(contents) + + self.assertEqual(options.ignore, ["E226", "E24"]) |