More fine-grained control of docstring and comment length
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 28/100
Rechercherichtung
Beginne mit der Durchsicht der Diskussion in #344 und der beiden Kommentare zu diesem Issue, insbesondere der vorgeschlagenen Standardwerte für mehrzeilige docstrings, einzeilige docstrings und Kommentarblöcke. Die Arbeit ist abgeschlossen, wenn sich die Maintainer auf die Einstellungen und das Verhalten geeinigt haben und die Implementierung die dokumentierten Beispiele ohne offene Designfragen abdeckt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
As discussed/hijacked in #344, I proposed to have an option to limit the length of docstring and comments:
- Multi-line docstring:
max_doc_length, default tomax_line_length(current behavior) - Single-line docstring:
max_single_doc_length, default tomax_doc_length + 3ifmax_doc_lengthis set, otherwise tomax_line_length - Comment block:
max_comment_length, default tomax_doc_length(current behavior)
Answer to @asottile
I don't think the complexity of a bunch of new settings is a good idea -- also your current proposal allows single line docstrings to extend beyond
max_line_length
I added that to the proposal. My rational is, consider these
"""Something that span 72 columns.
Some additional description.
"""
"""The same first line."""
then the second case actually reaches 75 columns. I'm not sure about others, but I consider
"""Blah blah blah.
"""
to be quite distasteful.
Answer to @timj
I'm really happy with the current situation and have no problem forcing my comment lines to match the docstring constraint.
Generally, I have no problem with breaking comments, but in a few places like copyright headers, it's not very nice, like in AGPL or LGPL:
# foobar is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# foobar is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with foobar. If not, see <https://www.gnu.org/licenses/>.
As you can see, the second-last line is 74 columns, and breaking it in any manner makes it look awkward, especially when these should be consistent between different languages.
Also to @brianv0, what's your opinion on this?
- Vorherrschende Sprache
- Python
- Sterne
- 5.2k
- Forks
- 765
- Ø Merge
- 1 T. 20 Std.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PyCQA/pycodestyle
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
PyCQA/pycodestyle#1294 · 1 Kommentar ·
-
Typing and formattingOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
PyCQA/pycodestyle#1302 · 3 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 42/100
PyCQA/pycodestyle#1242 · 2 Kommentare ·
-
Spurious E231 for nested format substitutionsEvtl. wieder frei @inchang-ing hat das vor 34 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
PyCQA/pycodestyle#1241 · 3 Kommentare · 4 Reaktionen ·
-
`exclude` is applied to `.`Evtl. wieder frei @OnlineBunker hat das vor 12 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
PyCQA/pycodestyle#1217 · 3 Kommentare ·
Alle Issues in PyCQA/pycodestyle
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
Library sweep logs an ERROR at start for the valkey instrumentor when valkey-py is not installedOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
JoahanMorales/upiixia-agentic-kit#99 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
NatLabRockies/openstudio-mcp#286 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100