LilSpazJoekp / docstrfmt

A formatter for reStructuredText
MIT License
23 stars 15 forks source link

Some reformatted docstrings are very long #75

Closed nemesifier closed 4 months ago

nemesifier commented 4 months ago

I am stumbling into a situation like the following:

@@ -7,23 +7,11 @@ from . import theme
 from .checks import admin_theme_settings_checks
 from .menu import register_menu_group

 def _staticfy(value):
-    """
-    Allows to keep backward compatibility with instances of OpenWISP which
-    were using the previous implementation of OPENWISP_ADMIN_THEME_LINKS
-    and OPENWISP_ADMIN_THEME_JS which didn't automatically pre-process
-    those lists of static files with django.templatetags.static.static()
-    and hence were not configured to allow those files to be found
-    by the staticfile loaders, if static() raises ValueError, we assume
-    one of either cases:
-    1. An old instance has upgraded and we keep returning the old value
-    so the file will continue being found although unprocessed by
-    django's static file machinery.
-    2. The value passed is wrong, instead of failing loudly we fail silently.
-    """
+    """Allows to keep backward compatibility with instances of OpenWISP which were using the previous implementation of OPENWISP_ADMIN_THEME_LINKS and OPENWISP_ADMIN_THEME_JS which didn't automatically pre-process those lists of static files with django.templatetags.static.static() and hence were not configured to allow those files to be found by the staticfile loaders, if static() raises ValueError, we assume one of either cases: 1. An old instance has upgraded and we keep returning the old value so the file will continue being found although unprocessed by django's static file machinery. 2. The value passed is wrong, instead of failing loudly we fail silently."""
     try:
         return static(value)
     # maintain backward compatibility
     except ValueError:
         return value

The length of the docstring seems to conflict with the line-length.

Is this intentional? It looks like a bug to me.

I think having the possibility to disable docstring check and/or allow to configure docstrings preferences a little bit would be great.

LilSpazJoekp commented 4 months ago

It is intention. The first line in a doc string is meant to be a short summary. I would recommend breaking up the paragraph into a summary sentence and a supporting paragraph

ETA: PEP-257

nemesifier commented 4 months ago

Ok, thanks for the clarification.