Skip to content

Wrong admonition reformat on v1.6.0.rc1 #157

@kdeldycke

Description

@kdeldycke

I am using docformatter 1.5.0 for a couple of month now by invoking the following CLI, which always worked fine:

$ docformatter --recursive --in-place --wrap-summaries 88 --wrap-descriptions 88 .

In order to test for the fix for #140, I updated to v1.6.0.rc1. Now the same call with the same parameters always exits with error code 3. See the log from my GitHub action:

$ docformatter --recursive --in-place --wrap-summaries 88 --wrap-descriptions 88 .
(...)
Error: Process completed with exit code 3.

How to reproduce

First, install v1.6.0.rc1:

$ pipx install git+https://github.com/PyCQA/docformatter.git@v1.6.0.rc1
  installed package docformatter 1.5.1, installed using Python 3.11.1
  These apps are now globally available
    - docformatter
done! ✨ 🌟 ✨
$ docformatter --version
docformatter 1.5.0

BTW, notice how the package is reported as 1.5.1 by pipx and 1.5.0 by docformatter itself. This is a confusing issue due to the 1.6.0.rc1 version string not being set in the development branch. Inspecting the code reveal pipx is perfectly doing its job and that's really is the v1.6.0.rc1 branch code we are running. For proof, the presence of the URL_PATTERNS constant that was added in commit 917fed92248d1fb91a1f4da61b5aaaec7367fe23:

$ grep -A 4 'URL_PATTERNS =' ~/.local/pipx/venvs/docformatter/lib/python3.11/site-packages/docformatter/syntax.py
URL_PATTERNS = (
    "afp|"
    "apt|"
    "bitcoin|"
    "chrome|"

Now that we run 1.6.0.rc1, let's download a minimal file from my project:

$ wget "https://raw.githubusercontent.com/kdeldycke/click-extra/86991e4023a962ff14e0ec774e534e118ad3b56e/click_extra/platform.py"
(...)
2023-01-24 (11.3 MB/s) - ‘platform.py’ saved

And run docformatter on it:

$ docformatter --recursive --in-place --wrap-summaries 88 --wrap-descriptions 88 ./platform.py
$ echo $?
3

Hypothesis

If we run the same command as above, on the same file, with the extra --diff parameter, we get:

$ docformatter --recursive --in-place --wrap-summaries 88 --wrap-descriptions 88 --diff ./platform.py
--- before/./platform.py
+++ after/./platform.py
@@ -21,9 +21,9 @@
 
 .. warning::
 
-    ``click_extra.platform`` is deprecated since version 3.8.0.
+``click_extra.platform`` is deprecated since version 3.8.0.
 
-    Use ``click_extra.platforms`` (with a trailing ``s``) instead.
+Use ``click_extra.platforms`` (with a trailing ``s``) instead.
 """
 
 import warnings
$ echo $?
3

Is the strange reformatting, which doesn't seems to recognize the .. warning:: admonition, can explain the constant exit with code 3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: styleRelates to docstring format style (e.g., Google, NumPy, Sphinx)P: bugPEP 257 violation or existing functionality that doesn't work as documented

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions