Skip to content

Commit

Permalink
release: v1.7.0 (#197)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
weibullguy authored May 15, 2023
1 parent 3d6da2b commit 97883db
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = 'docformatter'
copyright = '2022-2023, Steven Myint'
author = 'Steven Myint'
release = '1.6.5'
release = '1.7.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/source/requirements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ the requirement falls in, the type of requirement, and whether
' PEP_257_9.4',' Should be documented whether keyword arguments are part of the interface.',' Methodology',' Should',' No'
' docformatter_10', '**docstring Syntax**'
' docformatter_10.1', ' Should wrap docstrings at n characters.', ' Style', ' Should', ' Yes'
' docformatter_10.1.1', ' Shall not wrap lists or syntax directive statements', ' Derived', ' Shall', ' Yes'
' docformatter_10.1.1', ' Shall not wrap lists, syntax directive statements, or literal blocks', ' Derived', ' Shall', ' Yes'
' docformatter_10.1.1.1', ' Should allow wrapping of lists and syntax directive statements.', ' Stakeholder', ' Should', ' Yes [*PR #5*, *PR #93*]'
' docformatter_10.1.2', ' Should allow/disallow wrapping of one-line docstrings.', ' Derived', ' Should', ' No'
' docformatter_10.1.3', ' Shall not wrap links that exceed the wrap length.', ' Derived', ' Shall', ' Yes [*PR #114*]'
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "docformatter"
version = "1.6.5"
version = "1.7.0"
description = "Formats docstrings to follow PEP 257"
authors = ["Steven Myint"]
maintainers = [
Expand Down Expand Up @@ -249,8 +249,8 @@ deps =
commands =
pip install -U pip
pip install .
docformatter --recursive {toxinidir}/src/docformatter
pycodestyle --ignore=E203,W503,W504 {toxinidir}/src/docformatter
docformatter --black --recursive {toxinidir}/src/docformatter
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
pydocstyle {toxinidir}/src/docformatter
pylint --rcfile={toxinidir}/pyproject.toml {toxinidir}/src/docformatter
rstcheck --report-level=1 {toxinidir}/README.rst
Expand Down
2 changes: 1 addition & 1 deletion src/docformatter/__pkginfo__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
# SOFTWARE.
"""Package information for docformatter."""

__version__ = "1.6.5"
__version__ = "1.7.0"
21 changes: 15 additions & 6 deletions src/docformatter/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,12 +351,18 @@ def do_split_description(

# Finally, add everything after the last URL.
with contextlib.suppress(IndexError):
_stripped_text = (
text[_text_idx + 1 :].strip(indentation)
_text = (
text[_text_idx + 1 :]
if text[_text_idx] == "\n"
else text[_text_idx:].strip()
else text[_text_idx:]
)
_lines.append(f"{indentation}{_stripped_text}")
_text = _text.splitlines()
for _idx, _line in enumerate(_text):
if _line not in ["", "\n", f"{indentation}"]:
_text[_idx] = f"{indentation}{_line.strip()}"

_lines += _text

return _lines


Expand Down Expand Up @@ -410,6 +416,9 @@ def is_some_sort_of_list(text: str, strict: bool) -> bool:
or
# "parameter -- description"
re.match(r"\s*\S+\s+--\s+", line)
or
# "parameter::" <-- Literal block
re.match(r"\s*[\S ]*:{2}", line)
)
for line in split_lines
)
Expand Down Expand Up @@ -495,8 +504,8 @@ def wrap_summary(summary, initial_indent, subsequent_indent, wrap_length):
def wrap_description(text, indentation, wrap_length, force_wrap, strict):
"""Return line-wrapped description text.
We only wrap simple descriptions. We leave doctests, multi-paragraph
text, and bulleted lists alone.
We only wrap simple descriptions. We leave doctests, multi-paragraph text, and
bulleted lists alone.
"""
text = strip_leading_blank_lines(text)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_format_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ def test_format_docstring_with_short_inline_link(
"args",
[["--wrap-descriptions", "72", ""]],
)
def test_format_docstring_with_short_inline_link(
def test_format_docstring_with_long_inline_link(
self,
test_args,
args,
Expand Down Expand Up @@ -1274,7 +1274,7 @@ def test_format_docstring_keep_inline_link_together_two_paragraphs(
User configuration is
`merged to the context default_map as Click does <https://click.palletsprojects.com/en/8.1.x/commands/#context-defaults>`_.
This allow user\'s config to only overrides defaults. Values sets from direct
command line parameters, environment variables or interactive prompts, takes
precedence over any values from the config file.
Expand Down
22 changes: 22 additions & 0 deletions tests/test_utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,28 @@ def test_is_some_sort_of_list_non_strict_wrap(self):
False,
)

@pytest.mark.unit
def test_is_some_sort_of_list_literal_block(self):
"""Identify literal blocks.
See issue #199 and requirement docformatter_10.1.1.1.
"""
assert docformatter.is_some_sort_of_list(
"""\
This is a description.
Example code::
config(par=value)
Example code2::
with config(par=value) as f:
pass
""",
False,
)


class TestIsSomeSortOfCode:
"""Class for testing the is_some_sort_of_code() function."""
Expand Down

0 comments on commit 97883db

Please sign in to comment.