Repository: PyCQA/docformatter (python)

Issue:
Wrapping yield tag
Hi,
With the latest docformatter (1.7.4) any yield tags in my docstrings are being wrapped into the line above.
```
    """
    My test fixture.

    :param caplog: Pytest caplog fixture.
    :yield: Until test complete, then run cleanup.
    """
```
Turns into
```
    """
    My test fixture.

    :param caplog: Pytest caplog fixture. :yield: Until test complete, then run cleanup.
    """
```

I understand that `yield` is not part of the official Sphinx docstring spec, but we have adopted them as we use darglint to lint our docstrings and that flags a `DAR301 Missing "Yields" in Docstring" if we do not document our yield.
Plus it is good to be able to document what functions yield within their docstring.

I am running docformatter in a pre-commit hook with the following configuration:
```
  - repo: https://github.com/pycqa/docformatter
    rev: v1.7.4
    hooks:
      - id: docformatter
        args:
          - --black
          - --in-place
          - --pre-summary-newline
          - --wrap-summaries=120
          - --wrap-descriptions=120
```

Pull request:
fix: not recognizing `yield` as a sphinx field name
Adds `yield` to the list of sphinx field names.

Closes #253 

Patch:
diff --git a/src/docformatter/syntax.py b/src/docformatter/syntax.py
index c6af9a6..a389341 100644
--- a/src/docformatter/syntax.py
+++ b/src/docformatter/syntax.py
@@ -59,7 +59,7 @@ OPTION_REGEX = r"^-{1,2}[\S ]+ {2}\S+"
 REST_REGEX = r"((\.{2}|`{2}) ?[\w.~-]+(:{2}|`{2})?[\w ]*?|`[\w.~]+`)"
 """Regular expression to use for finding reST directives."""
 
-SPHINX_REGEX = r":(param|raises|return|rtype|type)[a-zA-Z0-9_\-.() ]*:"
+SPHINX_REGEX = r":(param|raises|return|rtype|type|yield)[a-zA-Z0-9_\-.() ]*:"
 """Regular expression to use for finding Sphinx-style field lists."""
 
 URL_PATTERNS = (


Test patch:
diff --git a/tests/_data/string_files/format_sphinx.toml b/tests/_data/string_files/format_sphinx.toml
index e2e566e..38eefaa 100644
--- a/tests/_data/string_files/format_sphinx.toml
+++ b/tests/_data/string_files/format_sphinx.toml
@@ -236,3 +236,17 @@ outstring='''"""CC.
 
     c c :math:`[0, 1]`.
     """'''
+
+[issue_253]
+instring='''"""
+    My test fixture.
+
+    :param caplog: Pytest caplog fixture.
+    :yield: Until test complete, then run cleanup.
+    """'''
+outstring='''"""
+    My test fixture.
+
+    :param caplog: Pytest caplog fixture.
+    :yield: Until test complete, then run cleanup.
+    """'''
diff --git a/tests/formatter/test_format_sphinx.py b/tests/formatter/test_format_sphinx.py
index 297d682..03480db 100644
--- a/tests/formatter/test_format_sphinx.py
+++ b/tests/formatter/test_format_sphinx.py
@@ -433,3 +433,42 @@ class TestFormatWrapSphinx:
             INDENTATION,
             instring,
         )
+
+    @pytest.mark.unit
+    @pytest.mark.parametrize(
+        "args",
+        [
+            [
+                "--wrap-descriptions",
+                "120",
+                "--wrap-summaries",
+                "120",
+                "--pre-summary-newline",
+                "--black",
+                "",
+            ]
+        ],
+    )
+    def test_format_docstring_sphinx_style_recognize_yield(
+        self,
+        test_args,
+        args,
+    ):
+        """Should identify `yield` as sphinx field name.
+
+        See issue #253.
+        """
+        uut = Formatter(
+            test_args,
+            sys.stderr,
+            sys.stdin,
+            sys.stdout,
+        )
+
+        instring = self.TEST_STRINGS["issue_253"]["instring"]
+        outstring = self.TEST_STRINGS["issue_253"]["outstring"]
+
+        assert outstring == uut._do_format_docstring(
+            INDENTATION,
+            instring,
+        )