Skip to content

Commit 97883db

Browse files
authored
release: v1.7.0 (#197)
* chore: update version strings * ci: update GH action to pass --black to docformatter * ci: update GH action for pycodestyle options * ci: update GH action for pycodestyle options * fix: adding indentation to blank lines * chore: update version strings * fix: wrapping literal blocks * chore: update release and tag workflows * chore: update version strings
1 parent 3d6da2b commit 97883db

File tree

7 files changed

+45
-14
lines changed

7 files changed

+45
-14
lines changed

Diff for: docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
project = 'docformatter'
1010
copyright = '2022-2023, Steven Myint'
1111
author = 'Steven Myint'
12-
release = '1.6.5'
12+
release = '1.7.0'
1313

1414
# -- General configuration ---------------------------------------------------
1515
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

Diff for: docs/source/requirements.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ the requirement falls in, the type of requirement, and whether
194194
' PEP_257_9.4',' Should be documented whether keyword arguments are part of the interface.',' Methodology',' Should',' No'
195195
' docformatter_10', '**docstring Syntax**'
196196
' docformatter_10.1', ' Should wrap docstrings at n characters.', ' Style', ' Should', ' Yes'
197-
' docformatter_10.1.1', ' Shall not wrap lists or syntax directive statements', ' Derived', ' Shall', ' Yes'
197+
' docformatter_10.1.1', ' Shall not wrap lists, syntax directive statements, or literal blocks', ' Derived', ' Shall', ' Yes'
198198
' docformatter_10.1.1.1', ' Should allow wrapping of lists and syntax directive statements.', ' Stakeholder', ' Should', ' Yes [*PR #5*, *PR #93*]'
199199
' docformatter_10.1.2', ' Should allow/disallow wrapping of one-line docstrings.', ' Derived', ' Should', ' No'
200200
' docformatter_10.1.3', ' Shall not wrap links that exceed the wrap length.', ' Derived', ' Shall', ' Yes [*PR #114*]'

Diff for: pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "docformatter"
3-
version = "1.6.5"
3+
version = "1.7.0"
44
description = "Formats docstrings to follow PEP 257"
55
authors = ["Steven Myint"]
66
maintainers = [
@@ -249,8 +249,8 @@ deps =
249249
commands =
250250
pip install -U pip
251251
pip install .
252-
docformatter --recursive {toxinidir}/src/docformatter
253-
pycodestyle --ignore=E203,W503,W504 {toxinidir}/src/docformatter
252+
docformatter --black --recursive {toxinidir}/src/docformatter
253+
pycodestyle --exclude=.git,.tox,*.pyc,*.pyo,build,dist,*.egg-info,config,docs,locale,tests,tools --ignore=C326,C330,E121,E123,E126,E133,E203,E242,E265,E402,W503,W504 --format=pylint --max-line-length=88 {toxinidir}/src/docformatter
254254
pydocstyle {toxinidir}/src/docformatter
255255
pylint --rcfile={toxinidir}/pyproject.toml {toxinidir}/src/docformatter
256256
rstcheck --report-level=1 {toxinidir}/README.rst

Diff for: src/docformatter/__pkginfo__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
# SOFTWARE.
2424
"""Package information for docformatter."""
2525

26-
__version__ = "1.6.5"
26+
__version__ = "1.7.0"

Diff for: src/docformatter/syntax.py

+15-6
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,18 @@ def do_split_description(
351351

352352
# Finally, add everything after the last URL.
353353
with contextlib.suppress(IndexError):
354-
_stripped_text = (
355-
text[_text_idx + 1 :].strip(indentation)
354+
_text = (
355+
text[_text_idx + 1 :]
356356
if text[_text_idx] == "\n"
357-
else text[_text_idx:].strip()
357+
else text[_text_idx:]
358358
)
359-
_lines.append(f"{indentation}{_stripped_text}")
359+
_text = _text.splitlines()
360+
for _idx, _line in enumerate(_text):
361+
if _line not in ["", "\n", f"{indentation}"]:
362+
_text[_idx] = f"{indentation}{_line.strip()}"
363+
364+
_lines += _text
365+
360366
return _lines
361367

362368

@@ -410,6 +416,9 @@ def is_some_sort_of_list(text: str, strict: bool) -> bool:
410416
or
411417
# "parameter -- description"
412418
re.match(r"\s*\S+\s+--\s+", line)
419+
or
420+
# "parameter::" <-- Literal block
421+
re.match(r"\s*[\S ]*:{2}", line)
413422
)
414423
for line in split_lines
415424
)
@@ -495,8 +504,8 @@ def wrap_summary(summary, initial_indent, subsequent_indent, wrap_length):
495504
def wrap_description(text, indentation, wrap_length, force_wrap, strict):
496505
"""Return line-wrapped description text.
497506
498-
We only wrap simple descriptions. We leave doctests, multi-paragraph
499-
text, and bulleted lists alone.
507+
We only wrap simple descriptions. We leave doctests, multi-paragraph text, and
508+
bulleted lists alone.
500509
"""
501510
text = strip_leading_blank_lines(text)
502511

Diff for: tests/test_format_docstring.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ def test_format_docstring_with_short_inline_link(
10261026
"args",
10271027
[["--wrap-descriptions", "72", ""]],
10281028
)
1029-
def test_format_docstring_with_short_inline_link(
1029+
def test_format_docstring_with_long_inline_link(
10301030
self,
10311031
test_args,
10321032
args,
@@ -1274,7 +1274,7 @@ def test_format_docstring_keep_inline_link_together_two_paragraphs(
12741274
12751275
User configuration is
12761276
`merged to the context default_map as Click does <https://click.palletsprojects.com/en/8.1.x/commands/#context-defaults>`_.
1277-
1277+
12781278
This allow user\'s config to only overrides defaults. Values sets from direct
12791279
command line parameters, environment variables or interactive prompts, takes
12801280
precedence over any values from the config file.

Diff for: tests/test_utility_functions.py

+22
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,28 @@ def test_is_some_sort_of_list_non_strict_wrap(self):
492492
False,
493493
)
494494

495+
@pytest.mark.unit
496+
def test_is_some_sort_of_list_literal_block(self):
497+
"""Identify literal blocks.
498+
499+
See issue #199 and requirement docformatter_10.1.1.1.
500+
"""
501+
assert docformatter.is_some_sort_of_list(
502+
"""\
503+
This is a description.
504+
505+
Example code::
506+
507+
config(par=value)
508+
509+
Example code2::
510+
511+
with config(par=value) as f:
512+
pass
513+
""",
514+
False,
515+
)
516+
495517

496518
class TestIsSomeSortOfCode:
497519
"""Class for testing the is_some_sort_of_code() function."""

0 commit comments

Comments
 (0)