summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2019-01-23 07:59:09 -0800
committerAnthony Sottile <asottile@umich.edu>2019-01-29 08:58:10 -0800
commit50e7cc71b99e49103177ae1fcd497abc696c114c (patch)
tree7d7e904ca37e7204802c5b25e3adb09bcd16d342
parent532ea9ccab8a6271230d14b3f274e98bf829caba (diff)
downloadflake8-50e7cc71b99e49103177ae1fcd497abc696c114c.tar.gz
Latest pycodestyle
-rw-r--r--docs/source/plugin-development/plugin-parameters.rst1
-rw-r--r--setup.cfg4
-rw-r--r--setup.py3
-rw-r--r--src/flake8/main/options.py11
-rw-r--r--src/flake8/processor.py3
-rw-r--r--tests/unit/test_checker_manager.py2
-rw-r--r--tests/unit/test_file_processor.py1
7 files changed, 21 insertions, 4 deletions
diff --git a/docs/source/plugin-development/plugin-parameters.rst b/docs/source/plugin-development/plugin-parameters.rst
index 01b8b74..b7a4221 100644
--- a/docs/source/plugin-development/plugin-parameters.rst
+++ b/docs/source/plugin-development/plugin-parameters.rst
@@ -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.lines`
- :attr:`~flake8.processor.FileProcessor.max_line_length`
+- :attr:`~flake8.processor.FileProcessor.max_doc_length`
- :attr:`~flake8.processor.FileProcessor.total_lines`
- :attr:`~flake8.processor.FileProcessor.verbose`
diff --git a/setup.cfg b/setup.cfg
index 0dfa793..697b08c 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -14,6 +14,6 @@ requires-dist =
enum34; python_version<"3.4"
typing; python_version<"3.5"
configparser; python_version<"3.2"
- pyflakes >= 2.0.0, < 2.1.0
- pycodestyle >= 2.4.0, < 2.5.0
+ pyflakes >= 2.1.0, < 2.2.0
+ pycodestyle >= 2.5.0, < 2.6.0
mccabe >= 0.6.0, < 0.7.0
diff --git a/setup.py b/setup.py
index 528fc73..928a18c 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ requires = [
# http://flake8.pycqa.org/en/latest/internal/releases.html#releasing-flake8
"entrypoints >= 0.2.3, < 0.3.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",
]
@@ -115,6 +115,7 @@ setuptools.setup(
PEP8_PLUGIN('comparison_type'),
PEP8_PLUGIN('ambiguous_identifier'),
PEP8_PLUGIN('bare_except'),
+ PEP8_PLUGIN('maximum_doc_length'),
PEP8_PLUGIN('python_3000_has_key'),
PEP8_PLUGIN('python_3000_raise_comma'),
PEP8_PLUGIN('python_3000_not_equal'),
diff --git a/src/flake8/main/options.py b/src/flake8/main/options.py
index 666f42a..d2a7159 100644
--- a/src/flake8/main/options.py
+++ b/src/flake8/main/options.py
@@ -21,6 +21,7 @@ def register_default_options(option_manager):
- ``--extend-ignore``
- ``--per-file-ignores``
- ``--max-line-length``
+ - ``--max-doc-length``
- ``--select``
- ``--disable-noqa``
- ``--show-source``
@@ -165,6 +166,16 @@ def register_default_options(option_manager):
)
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(
"--select",
metavar="errors",
default=",".join(defaults.SELECT),
diff --git a/src/flake8/processor.py b/src/flake8/processor.py
index 47f5cd2..ece20b6 100644
--- a/src/flake8/processor.py
+++ b/src/flake8/processor.py
@@ -35,6 +35,7 @@ class FileProcessor(object):
- :attr:`line_number`
- :attr:`logical_line`
- :attr:`max_line_length`
+ - :attr:`max_doc_length`
- :attr:`multiline`
- :attr:`noqa`
- :attr:`previous_indent_level`
@@ -80,6 +81,8 @@ class FileProcessor(object):
self.logical_line = ""
#: Maximum line length as configured by the user
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
self.multiline = False
#: Whether or not we're observing NoQA
diff --git a/tests/unit/test_checker_manager.py b/tests/unit/test_checker_manager.py
index 02397f0..2b6cb76 100644
--- a/tests/unit/test_checker_manager.py
+++ b/tests/unit/test_checker_manager.py
@@ -23,7 +23,7 @@ def test_oserrors_cause_serial_fall_back():
with mock.patch('_multiprocessing.SemLock', side_effect=err):
manager = checker.Manager(style_guide, [], [])
with mock.patch.object(manager, 'run_serial') as serial:
- manager.run()
+ manager.run()
assert serial.call_count == 1
assert manager.using_multiprocessing is False
diff --git a/tests/unit/test_file_processor.py b/tests/unit/test_file_processor.py
index e83136a..04d816d 100644
--- a/tests/unit/test_file_processor.py
+++ b/tests/unit/test_file_processor.py
@@ -13,6 +13,7 @@ def options_from(**kwargs):
"""Generate a Values instances with our kwargs."""
kwargs.setdefault('hang_closing', True)
kwargs.setdefault('max_line_length', 79)
+ kwargs.setdefault('max_doc_length', None)
kwargs.setdefault('verbose', False)
kwargs.setdefault('stdin_display_name', 'stdin')
return optparse.Values(kwargs)