summaryrefslogtreecommitdiff
path: root/pylint/utils/utils.py
diff options
context:
space:
mode:
authorMikhail Fesenko <m.fesenko@corp.vk.com>2019-10-02 14:58:00 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2019-10-03 09:19:24 +0200
commitbeab1555b4b9aa8548c9968b08ca2e940fb59c2a (patch)
tree5d63dcae3dbbf884d741ab28e9a0eef28b1419df /pylint/utils/utils.py
parent47fdef57e6c453ddbd65d4960db20c0e580ee041 (diff)
downloadpylint-git-beab1555b4b9aa8548c9968b08ca2e940fb59c2a.tar.gz
Removed duplicates of code, changed default to common default value
Diffstat (limited to 'pylint/utils/utils.py')
-rw-r--r--pylint/utils/utils.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/pylint/utils/utils.py b/pylint/utils/utils.py
index 5605ecd06..0bf4722c0 100644
--- a/pylint/utils/utils.py
+++ b/pylint/utils/utils.py
@@ -15,8 +15,10 @@ from astroid import Module, modutils
from pylint.constants import PY_EXTS
+DEFAULT_LINE_LENGTH = 79
-def normalize_text(text, line_len=80, indent=""):
+
+def normalize_text(text, line_len=DEFAULT_LINE_LENGTH, indent=""):
"""Wrap the text on the given line length."""
return "\n".join(
textwrap.wrap(
@@ -53,13 +55,13 @@ def get_rst_section(section, options, doc=None):
if section:
result += get_rst_title(section, "'")
if doc:
- formatted_doc = normalize_text(doc, line_len=79, indent="")
+ formatted_doc = normalize_text(doc)
result += "%s\n\n" % formatted_doc
for optname, optdict, value in options:
help_opt = optdict.get("help")
result += ":%s:\n" % optname
if help_opt:
- formatted_help = normalize_text(help_opt, line_len=79, indent=" ")
+ formatted_help = normalize_text(help_opt, indent=" ")
result += "%s\n" % formatted_help
if value:
value = str(_format_option_value(optdict, value))
@@ -354,7 +356,7 @@ def _ini_format(stream, options):
value = _format_option_value(optdict, value)
help_opt = optdict.get("help")
if help_opt:
- help_opt = normalize_text(help_opt, line_len=79, indent="# ")
+ help_opt = normalize_text(help_opt, indent="# ")
print(file=stream)
print(help_opt, file=stream)
else: