BUG: Inconsistent behavior between `docformatter` and `black`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
The report shows disagreements across six Python files and includes Black's diffs, but does not identify docformatter's implementation or tests. Start by reproducing with the reported docformatter and Black versions, then inspect how docformatter formats these cases and the project's formatter tests. Done when the reported cases produce output accepted by both tools.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Env
Installed tools :
python --version
Python 3.12.7
docformatter --version
docformatter 1.7.8
black --version
black, 26.10.1 (compiled: yes)
Python (CPython) 3.12.7
pyproject.toml :
[tool.docformatter]
wrap-summaries = 88 # --black
wrap-descriptions = 88 # --black
pre-summary-newline = true
close-quotes-on-newline = true
[tool.black]
line-length = 88
target-version = ['py312']
extend-exclude = '''
/(
assets
)/
'''
Problem
Executions 1 (All code has been formatted by black):
docformatter --check --recursive --black onvif tests docs
docs\hooks\misc.py
onvif\operator.py
onvif\cli\helpers\products.py
tests\cli\test_cli_helper_wsdl_parser.py
tests\cli\test_cli_interactive_service.py
tests\utilities\test_exceptions.py
black --check .
All done! ✨ 🍰 ✨
179 files would be left unchanged.
For docformatter, code styles that have already been formatted by black are considered to have failed or to be non-compliant with the standards.
Executions 2 (All code has been formatted by docformatter):
docformatter --recursive --black --in-place onvif tests docs
black --check .
would reformat F:\Forks\onvif-python\docs\hooks\misc.py
would reformat F:\Forks\onvif-python\onvif\cli\helpers\products.py
would reformat F:\Forks\onvif-python\onvif\operator.py
would reformat F:\Forks\onvif-python\tests\utilities\test_exceptions.py
would reformat F:\Forks\onvif-python\tests\cli\test_cli_helper_wsdl_parser.py
would reformat F:\Forks\onvif-python\tests\cli\test_cli_interactive_service.py
Oh no! 💥 💔 💥
6 files would be reformatted, 173 files would be left unchanged.
Once all docstrings and code have been formatted by docformatter, now black then considers them unformatted.
Diff for debugging
black --diff docs/hooks/misc.py onvif/operator.py onvif/cli/helpers/products.py tests/utilities/test_exceptions.py tests/cli/test_cli_helper_wsdl_parser.py tests/cli/test_cli_interactive_service.py
--- docs\hooks\misc.py 2026-10-21 19:46:44.117053+00:00
+++ docs\hooks\misc.py 2026-10-21 19:48:41.899862+00:00
@@ -1,6 +1,7 @@
"""Misc Mkdocs hooks."""
+
def on_page_content(html, page, config, files): # pylint: disable=unused-argument
"""Exclude mkdocstrings source blocks from Material search."""
return html.replace(
'<details class="mkdocstrings-source">',
would reformat docs\hooks\misc.py
--- onvif\cli\helpers\products.py 2026-10-21 19:46:44.299099+00:00
+++ onvif\cli\helpers\products.py 2026-10-21 19:48:42.029537+00:00
@@ -24,21 +24,21 @@
# Get the database path relative to the script location
db_path = Path(__file__).resolve().parent.parent.parent / "db" / "products.db"
if not os.path.exists(db_path):
print(
- f"{colorize('Error:', 'red')} " f"Products database not found at {db_path}"
+ f"{colorize('Error:', 'red')} " f"Products database not found at {db_path}"
)
sys.exit(1)
# Validate pagination parameters
if page < 1:
print(f"{colorize('Error:', 'red')} Page number must be 1 or greater")
sys.exit(1)
if per_page < 1 or per_page > 100:
- print(f"{colorize('Error:', 'red')} " "Per-page must be between 1 and 100")
+ print(f"{colorize('Error:', 'red')} " "Per-page must be between 1 and 100")
sys.exit(1)
try:
conn = sqlite3.connect(db_path)
cursor = conn.cursor()
would reformat onvif\cli\helpers\products.py
--- onvif\operator.py 2026-10-21 19:46:44.226079+00:00
+++ onvif\operator.py 2026-10-21 19:48:42.044543+00:00
@@ -87,10 +87,11 @@
:material-alert-circle:{ .danger } Requires disk I/O and a writable cache directory
!!! bug "Use case" Production applications, CLI tools, and environments where
WSDL/XSD caching should persist across restarts.
"""
+
class ONVIFOperator:
"""
<!-- md:version 0.0.1 --> <!-- md:internal -->
would reformat onvif\operator.py
--- tests\utilities\test_exceptions.py 2026-10-21 19:46:45.729424+00:00
+++ tests\utilities\test_exceptions.py 2026-10-21 19:48:42.071102+00:00
@@ -34,22 +34,18 @@
"""exceptions."""
class RequestException(Exception):
"""RequestException."""
-
class ConnectionError(RequestException):
"""ConnectionError."""
-
class Timeout(RequestException):
"""Timeout."""
-
class ReadTimeout(Timeout):
"""ReadTimeout."""
-
requests = MockRequestsModule() # type: ignore[assignment]
class TestONVIFOperationException:
would reformat tests\utilities\test_exceptions.py
--- tests\cli\test_cli_helper_wsdl_parser.py 2026-10-21 19:46:45.158408+00:00
+++ tests\cli\test_cli_helper_wsdl_parser.py 2026-10-21 19:48:42.138691+00:00
@@ -418,12 +418,11 @@
assert result == "Hello world from parser"
def test_handles_multiline_links(self):
"""Test converting links whose content spans multiple lines."""
- result = clean_documentation_html(\
- """
+ result = clean_documentation_html("""
<a href="https://example.com">
Example
</a>
""")
@@ -443,12 +442,11 @@
assert extract_documentation_text(element) == "Hello world"
def test_text_and_children(self):
"""Test extracting text before, inside, and after child elements."""
- element = etree.fromstring(\
- b"""
+ element = etree.fromstring(b"""
<documentation>
Before
<b>middle</b>
After
</documentation>
would reformat tests\cli\test_cli_helper_wsdl_parser.py
--- tests\cli\test_cli_interactive_service.py 2026-10-21 19:46:45.301377+00:00
+++ tests\cli\test_cli_interactive_service.py 2026-10-21 19:48:42.218530+00:00
@@ -734,11 +734,11 @@
{
"name": "Token",
"type": "string",
"minOccurs": "1",
"maxOccurs": "1",
- "documentation": ("First line.\n" "\n" "Second line."),
+ "documentation": ("First line.\n" "\n" "Second line."),
}
],
},
"output": None,
}
would reformat tests\cli\test_cli_interactive_service.py
- Lenguaje dominante
- Python
- Estrellas
- 598
- Forks
- 97
- Merge medio
- 1 d 8 h
- PR fusionados (30 d)
- 11
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PyCQA/docformatter
-
1.7.8 crashes with a tokenize ValueError on a multi-line f-string inside parenthesesQuizá libre de nuevo @adityaanikam la tomó hace 74 días y no hay ningún pull request abierto. AbiertoC: convention P: bug U: high
Dificultad 3/5 1-2 días Aptitud para principiantes 74/100
PyCQA/docformatter#367 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
1.7.8 rewrites the contents of a non-docstring triple-quoted string, silently changing its valueAbiertoC: convention P: bug U: high
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
PyCQA/docformatter#366 ·
Los mantenedores suelen responder en 1 día
-
C: stakeholder P: enhancement U: low
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
PyCQA/docformatter#346 ·
Los mantenedores suelen responder en 1 día
-
C: convention P: bug U: high
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
PyCQA/docformatter#345 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Multiline summary is not split correctlyQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. AbiertoC: convention P: bug U: high
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
PyCQA/docformatter#315 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de PyCQA/docformatter
Issues similares
-
type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
push_gh-pages fails on master branch on forksPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertogood first issue infrastructure
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
kuznia-rdzeni/coreblocks#1135 ·
-
good first issue server
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
documentation priority: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
a-lex-s/mealie-telegram-bot#54 ·
Los mantenedores suelen responder en 1 día