More fine-grained control of docstring and comment length
まだ誰も着手していません。
評価
調査の方向性
まず #344 の議論とこの Issue に対する 2 件のコメントを確認してください。特に、複数行の docstrings、1 行の docstrings、コメントブロックに対して提案されているデフォルト値を確認します。メンテナーが設定と動作について合意し、実装が未解決の設計上の問題なしにドキュメント化された例を網羅した時点で、作業は完了です。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- Python
- スター
- 5.2k
- フォーク
- 765
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PyCQA/pycodestyle のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
PyCQA/pycodestyle#1294 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
PyCQA/pycodestyle#1302 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
PyCQA/pycodestyle#1242 · コメント 2 件 ·
-
Spurious E231 for nested format substitutions再び着手できるかも @inchang-ing が 34 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
PyCQA/pycodestyle#1241 · コメント 3 件 · リアクション 4 件 ·
-
`exclude` is applied to `.`再び着手できるかも @OnlineBunker が 12 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
PyCQA/pycodestyle#1217 · コメント 3 件 ·
PyCQA/pycodestyle の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
Library sweep logs an ERROR at start for the valkey instrumentor when valkey-py is not installedオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
JoahanMorales/upiixia-agentic-kit#99 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
NatLabRockies/openstudio-mcp#286 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100