Skip to content

Commit 44e7d80

Browse files
authored
release/v1.7.4 (#249)
* 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
1 parent b40677b commit 44e7d80

File tree

7 files changed

+64
-11
lines changed

7 files changed

+64
-11
lines changed

Diff for: .github/workflows/on-push-tag.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ jobs:
5656
if: ${{ env.build_ok == 1 }}
5757
uses: release-drafter/release-drafter@v5
5858
with:
59-
name: $env.tag
60-
tag: $env.tag
61-
version: $env.tag
59+
name: ${{ env.tag }}
60+
tag: ${{ env.tag }}
61+
version: ${{ env.tag }}
6262
prerelease: true
6363
publish: true
6464
env:

Diff for: docs/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
project = "docformatter"
1212
copyright = "2022-2023, Steven Myint"
1313
author = "Steven Myint"
14-
release = "1.7.3"
14+
release = "1.7.4"
1515

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

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "docformatter"
3-
version = "1.7.3"
3+
version = "1.7.4"
44
description = "Formats docstrings to follow PEP 257"
55
authors = ["Steven Myint"]
66
maintainers = [

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.7.3"
26+
__version__ = "1.7.4"

Diff for: src/docformatter/syntax.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
REST_REGEX = r"((\.{2}|`{2}) ?[\w.~-]+(:{2}|`{2})?[\w ]*?|`[\w.~]+`)"
6060
"""Regular expression to use for finding reST directives."""
6161

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

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

278278

279-
def do_find_field_lists(text: str, style: str):
279+
def do_find_field_lists(
280+
text: str,
281+
style: str,
282+
):
280283
r"""Determine if docstring contains any field lists.
281284
282285
Parameters

Diff for: tests/_data/string_files/format_sphinx.toml

+16-3
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ instring='''"""CC.
139139
"""'''
140140
outstring='''"""CC.
141141
142-
:math:`-`
142+
:math: `-`
143143
"""'''
144144

145145
[issue_230]
@@ -190,8 +190,7 @@ outstring='''"""CC.
190190
191191
C.
192192
193-
C,
194-
:math:`[0, 1]`.
193+
C, :math:`[0, 1]`.
195194
"""'''
196195

197196
[issue_239]
@@ -223,3 +222,17 @@ outstring='''"""Some f.
223222
:param a: Some param.
224223
:raises my.package.MyReallySrsError: Bad things happened.
225224
"""'''
225+
226+
[issue_250]
227+
instring=''' """CC.
228+
229+
c.
230+
231+
c c :math:`[0, 1]`.
232+
"""'''
233+
outstring='''"""CC.
234+
235+
c.
236+
237+
c c :math:`[0, 1]`.
238+
"""'''

Diff for: tests/formatter/test_format_sphinx.py

+37
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,40 @@ def test_format_docstring_sphinx_style_field_name_has_periods(
396396
INDENTATION,
397397
instring,
398398
)
399+
400+
@pytest.mark.unit
401+
@pytest.mark.parametrize(
402+
"args",
403+
[
404+
[
405+
"--wrap-descriptions",
406+
"88",
407+
"--wrap-summaries",
408+
"88",
409+
"",
410+
]
411+
],
412+
)
413+
def test_format_docstring_sphinx_style_ignore_directive(
414+
self,
415+
test_args,
416+
args,
417+
):
418+
"""Should not identify inline directives as sphinx field names.
419+
420+
See issue #250.
421+
"""
422+
uut = Formatter(
423+
test_args,
424+
sys.stderr,
425+
sys.stdin,
426+
sys.stdout,
427+
)
428+
429+
instring = self.TEST_STRINGS["issue_250"]["instring"]
430+
outstring = self.TEST_STRINGS["issue_250"]["outstring"]
431+
432+
assert outstring == uut._do_format_docstring(
433+
INDENTATION,
434+
instring,
435+
)

0 commit comments

Comments
 (0)