More fine-grained control of docstring and comment length
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 28/100
Direção de pesquisa
Comece revisando a discussão em #344 e os dois comentários nesta issue, especialmente os valores padrão propostos para docstrings de várias linhas, docstrings de uma única linha e blocos de comentários. O trabalho estará concluído quando os mantenedores concordarem sobre as configurações e o comportamento, e a implementação abranger os exemplos documentados sem questões de design não resolvidas.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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?
- Linguagem predominante
- Python
- Estrelas
- 5.2k
- Forks
- 765
- Merge médio
- 1d 20h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de PyCQA/pycodestyle
-
DOC: E252 is not documentedAberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
PyCQA/pycodestyle#1294 · 1 comentário ·
-
Typing and formattingAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 25/100
PyCQA/pycodestyle#1302 · 3 comentários ·
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
PyCQA/pycodestyle#1242 · 2 comentários ·
-
Spurious E231 for nested format substitutionsTalvez livre de novo @inchang-ing assumiu há 34 dias e não há nenhum pull request aberto. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
PyCQA/pycodestyle#1241 · 3 comentários · 4 reações ·
-
`exclude` is applied to `.`Talvez livre de novo @OnlineBunker assumiu há 12 dias e não há nenhum pull request aberto. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
PyCQA/pycodestyle#1217 · 3 comentários ·
Todas as issues de PyCQA/pycodestyle
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
-
Library sweep logs an ERROR at start for the valkey instrumentor when valkey-py is not installedAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
bug good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
JoahanMorales/upiixia-agentic-kit#99 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
NatLabRockies/openstudio-mcp#286 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100