More fine-grained control of docstring and comment length
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 28/100
Piste de recherche
Commencez par examiner la discussion dans #344 et les deux commentaires sur cette issue, en particulier les valeurs par défaut proposées pour les docstrings multilignes, les docstrings sur une seule ligne et les blocs de commentaires. Le travail est terminé lorsque les mainteneurs se sont mis d’accord sur les paramètres et le comportement, et que l’implémentation couvre les exemples documentés sans questions de conception non résolues.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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?
- Langage dominant
- Python
- Étoiles
- 5.2k
- Forks
- 765
- Merge moyen
- 1 j 20 h
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PyCQA/pycodestyle
-
DOC: E252 is not documentedOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
PyCQA/pycodestyle#1294 · 1 commentaire ·
-
Typing and formattingOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
PyCQA/pycodestyle#1302 · 3 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 42/100
PyCQA/pycodestyle#1242 · 2 commentaires ·
-
Spurious E231 for nested format substitutionsPeut-être à nouveau libre @inchang-ing l’a pris il y a 34 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 68/100
PyCQA/pycodestyle#1241 · 3 commentaires · 4 réactions ·
-
`exclude` is applied to `.`Peut-être à nouveau libre @OnlineBunker l’a pris il y a 12 jours, et aucune pull request n’est ouverte. Ouverte
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
PyCQA/pycodestyle#1217 · 3 commentaires ·
Toutes les issues de PyCQA/pycodestyle
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
Library sweep logs an ERROR at start for the valkey instrumentor when valkey-py is not installedOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
bug good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
JoahanMorales/upiixia-agentic-kit#99 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
NatLabRockies/openstudio-mcp#286 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100