Skip to content

Commit

Permalink
release/v1.7.4 (#249)
Browse files Browse the repository at this point in the history
* chore: update version strings

* fix: identifying reST directive as sphinx field item

* test: for identifying reST directive as sphinx field item

* chore: update version strings

* chore: fix workflow file

* chore: update version strings
  • Loading branch information
weibullguy authored Jul 10, 2023
1 parent b40677b commit 44e7d80
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/on-push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
if: ${{ env.build_ok == 1 }}
uses: release-drafter/release-drafter@v5
with:
name: $env.tag
tag: $env.tag
version: $env.tag
name: ${{ env.tag }}
tag: ${{ env.tag }}
version: ${{ env.tag }}
prerelease: true
publish: true
env:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = "docformatter"
copyright = "2022-2023, Steven Myint"
author = "Steven Myint"
release = "1.7.3"
release = "1.7.4"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "docformatter"
version = "1.7.3"
version = "1.7.4"
description = "Formats docstrings to follow PEP 257"
authors = ["Steven Myint"]
maintainers = [
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.7.3"
__version__ = "1.7.4"
7 changes: 5 additions & 2 deletions src/docformatter/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
REST_REGEX = r"((\.{2}|`{2}) ?[\w.~-]+(:{2}|`{2})?[\w ]*?|`[\w.~]+`)"
"""Regular expression to use for finding reST directives."""

SPHINX_REGEX = r":[a-zA-Z0-9_\-(). ]*:"
SPHINX_REGEX = r":(param|raises|return|rtype|type)[a-zA-Z0-9_\-.() ]*:"
"""Regular expression to use for finding Sphinx-style field lists."""

URL_PATTERNS = (
Expand Down Expand Up @@ -276,7 +276,10 @@ def do_find_directives(text: str) -> bool:
return bool([(_rest.start(0), _rest.end(0)) for _rest in _rest_iter])


def do_find_field_lists(text: str, style: str):
def do_find_field_lists(
text: str,
style: str,
):
r"""Determine if docstring contains any field lists.
Parameters
Expand Down
19 changes: 16 additions & 3 deletions tests/_data/string_files/format_sphinx.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ instring='''"""CC.
"""'''
outstring='''"""CC.
:math:`-`
:math: `-`
"""'''

[issue_230]
Expand Down Expand Up @@ -190,8 +190,7 @@ outstring='''"""CC.
C.
C,
:math:`[0, 1]`.
C, :math:`[0, 1]`.
"""'''

[issue_239]
Expand Down Expand Up @@ -223,3 +222,17 @@ outstring='''"""Some f.
:param a: Some param.
:raises my.package.MyReallySrsError: Bad things happened.
"""'''

[issue_250]
instring=''' """CC.
c.
c c :math:`[0, 1]`.
"""'''
outstring='''"""CC.
c.
c c :math:`[0, 1]`.
"""'''
37 changes: 37 additions & 0 deletions tests/formatter/test_format_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,40 @@ def test_format_docstring_sphinx_style_field_name_has_periods(
INDENTATION,
instring,
)

@pytest.mark.unit
@pytest.mark.parametrize(
"args",
[
[
"--wrap-descriptions",
"88",
"--wrap-summaries",
"88",
"",
]
],
)
def test_format_docstring_sphinx_style_ignore_directive(
self,
test_args,
args,
):
"""Should not identify inline directives as sphinx field names.
See issue #250.
"""
uut = Formatter(
test_args,
sys.stderr,
sys.stdin,
sys.stdout,
)

instring = self.TEST_STRINGS["issue_250"]["instring"]
outstring = self.TEST_STRINGS["issue_250"]["outstring"]

assert outstring == uut._do_format_docstring(
INDENTATION,
instring,
)

0 comments on commit 44e7d80

Please sign in to comment.