mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-12 15:44:17 +00:00
Latest pycodestyle
This commit is contained in:
parent
532ea9ccab
commit
50e7cc71b9
7 changed files with 21 additions and 4 deletions
|
|
@ -48,6 +48,7 @@ the data instead of being called on each physical or logical line.
|
||||||
- :attr:`~flake8.processor.FileProcessor.file_tokens`
|
- :attr:`~flake8.processor.FileProcessor.file_tokens`
|
||||||
- :attr:`~flake8.processor.FileProcessor.lines`
|
- :attr:`~flake8.processor.FileProcessor.lines`
|
||||||
- :attr:`~flake8.processor.FileProcessor.max_line_length`
|
- :attr:`~flake8.processor.FileProcessor.max_line_length`
|
||||||
|
- :attr:`~flake8.processor.FileProcessor.max_doc_length`
|
||||||
- :attr:`~flake8.processor.FileProcessor.total_lines`
|
- :attr:`~flake8.processor.FileProcessor.total_lines`
|
||||||
- :attr:`~flake8.processor.FileProcessor.verbose`
|
- :attr:`~flake8.processor.FileProcessor.verbose`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,6 @@ requires-dist =
|
||||||
enum34; python_version<"3.4"
|
enum34; python_version<"3.4"
|
||||||
typing; python_version<"3.5"
|
typing; python_version<"3.5"
|
||||||
configparser; python_version<"3.2"
|
configparser; python_version<"3.2"
|
||||||
pyflakes >= 2.0.0, < 2.1.0
|
pyflakes >= 2.1.0, < 2.2.0
|
||||||
pycodestyle >= 2.4.0, < 2.5.0
|
pycodestyle >= 2.5.0, < 2.6.0
|
||||||
mccabe >= 0.6.0, < 0.7.0
|
mccabe >= 0.6.0, < 0.7.0
|
||||||
|
|
|
||||||
3
setup.py
3
setup.py
|
|
@ -21,7 +21,7 @@ requires = [
|
||||||
# http://flake8.pycqa.org/en/latest/internal/releases.html#releasing-flake8
|
# http://flake8.pycqa.org/en/latest/internal/releases.html#releasing-flake8
|
||||||
"entrypoints >= 0.2.3, < 0.3.0",
|
"entrypoints >= 0.2.3, < 0.3.0",
|
||||||
"pyflakes >= 2.1.0, < 2.2.0",
|
"pyflakes >= 2.1.0, < 2.2.0",
|
||||||
"pycodestyle >= 2.4.0, < 2.5.0",
|
"pycodestyle >= 2.5.0, < 2.6.0",
|
||||||
"mccabe >= 0.6.0, < 0.7.0",
|
"mccabe >= 0.6.0, < 0.7.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -115,6 +115,7 @@ setuptools.setup(
|
||||||
PEP8_PLUGIN('comparison_type'),
|
PEP8_PLUGIN('comparison_type'),
|
||||||
PEP8_PLUGIN('ambiguous_identifier'),
|
PEP8_PLUGIN('ambiguous_identifier'),
|
||||||
PEP8_PLUGIN('bare_except'),
|
PEP8_PLUGIN('bare_except'),
|
||||||
|
PEP8_PLUGIN('maximum_doc_length'),
|
||||||
PEP8_PLUGIN('python_3000_has_key'),
|
PEP8_PLUGIN('python_3000_has_key'),
|
||||||
PEP8_PLUGIN('python_3000_raise_comma'),
|
PEP8_PLUGIN('python_3000_raise_comma'),
|
||||||
PEP8_PLUGIN('python_3000_not_equal'),
|
PEP8_PLUGIN('python_3000_not_equal'),
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ def register_default_options(option_manager):
|
||||||
- ``--extend-ignore``
|
- ``--extend-ignore``
|
||||||
- ``--per-file-ignores``
|
- ``--per-file-ignores``
|
||||||
- ``--max-line-length``
|
- ``--max-line-length``
|
||||||
|
- ``--max-doc-length``
|
||||||
- ``--select``
|
- ``--select``
|
||||||
- ``--disable-noqa``
|
- ``--disable-noqa``
|
||||||
- ``--show-source``
|
- ``--show-source``
|
||||||
|
|
@ -164,6 +165,16 @@ def register_default_options(option_manager):
|
||||||
"(Default: %default)",
|
"(Default: %default)",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_option(
|
||||||
|
"--max-doc-length",
|
||||||
|
type="int",
|
||||||
|
metavar="n",
|
||||||
|
default=None,
|
||||||
|
parse_from_config=True,
|
||||||
|
help="Maximum allowed doc line length for the entirety of this run. "
|
||||||
|
"(Default: %default)",
|
||||||
|
)
|
||||||
|
|
||||||
add_option(
|
add_option(
|
||||||
"--select",
|
"--select",
|
||||||
metavar="errors",
|
metavar="errors",
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class FileProcessor(object):
|
||||||
- :attr:`line_number`
|
- :attr:`line_number`
|
||||||
- :attr:`logical_line`
|
- :attr:`logical_line`
|
||||||
- :attr:`max_line_length`
|
- :attr:`max_line_length`
|
||||||
|
- :attr:`max_doc_length`
|
||||||
- :attr:`multiline`
|
- :attr:`multiline`
|
||||||
- :attr:`noqa`
|
- :attr:`noqa`
|
||||||
- :attr:`previous_indent_level`
|
- :attr:`previous_indent_level`
|
||||||
|
|
@ -80,6 +81,8 @@ class FileProcessor(object):
|
||||||
self.logical_line = ""
|
self.logical_line = ""
|
||||||
#: Maximum line length as configured by the user
|
#: Maximum line length as configured by the user
|
||||||
self.max_line_length = options.max_line_length
|
self.max_line_length = options.max_line_length
|
||||||
|
#: Maximum docstring / comment line length as configured by the user
|
||||||
|
self.max_doc_length = options.max_doc_length
|
||||||
#: Whether the current physical line is multiline
|
#: Whether the current physical line is multiline
|
||||||
self.multiline = False
|
self.multiline = False
|
||||||
#: Whether or not we're observing NoQA
|
#: Whether or not we're observing NoQA
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ def test_oserrors_cause_serial_fall_back():
|
||||||
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
with mock.patch('_multiprocessing.SemLock', side_effect=err):
|
||||||
manager = checker.Manager(style_guide, [], [])
|
manager = checker.Manager(style_guide, [], [])
|
||||||
with mock.patch.object(manager, 'run_serial') as serial:
|
with mock.patch.object(manager, 'run_serial') as serial:
|
||||||
manager.run()
|
manager.run()
|
||||||
assert serial.call_count == 1
|
assert serial.call_count == 1
|
||||||
assert manager.using_multiprocessing is False
|
assert manager.using_multiprocessing is False
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ def options_from(**kwargs):
|
||||||
"""Generate a Values instances with our kwargs."""
|
"""Generate a Values instances with our kwargs."""
|
||||||
kwargs.setdefault('hang_closing', True)
|
kwargs.setdefault('hang_closing', True)
|
||||||
kwargs.setdefault('max_line_length', 79)
|
kwargs.setdefault('max_line_length', 79)
|
||||||
|
kwargs.setdefault('max_doc_length', None)
|
||||||
kwargs.setdefault('verbose', False)
|
kwargs.setdefault('verbose', False)
|
||||||
kwargs.setdefault('stdin_display_name', 'stdin')
|
kwargs.setdefault('stdin_display_name', 'stdin')
|
||||||
return optparse.Values(kwargs)
|
return optparse.Values(kwargs)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue