Multiline summary is not split correctly
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #397 của @kritagyadubey — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
Hướng nghiên cứu
Bắt đầu với hàm split_summary và tái hiện ví dụ nhiều dòng trong issue. Kiểm tra cách các dòng được hàm trả về được sử dụng, sau đó thêm coverage hồi quy cho thứ tự được minh họa và xác nhận rằng output đã sửa vẫn giữ lại các dòng tiếp theo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I saw the error in CI because I used master (that was needed for a while to use with pre-commit version 4 and above).
Some multi lines sentences are split incorrectly. This is the behavior of the function split_summary
>>> split_summary(["First sentence is here. Second sentence is long", "and split in two. I even have a third sentence here.", "", "And other text here."])
['First sentence is here.',
'and split in two. I even have a third sentence here.',
'Second sentence is long',
'',
'And other text here.']
I think this comes from the split_summary function that does this:
lines[0] = first_sentence
if rest_text:
lines.insert(2, rest_text)
and inserts at the wrong place if we have sentences that are too long.
I am not familiar with the code base, but maybe something along those lines could work?
def split_summary(lines) -> List[str]:
"""Split multi-sentence summary into the first sentence and the rest."""
if not lines or not lines[0].strip():
return lines
text = lines[0].strip()
tokens = re.split(r"(\s+)", text) # Keep whitespace for accurate rejoining
sentence = []
rest = []
i = 0
while i < len(tokens):
token = tokens[i]
sentence.append(token)
if token.endswith(".") and not any(
"".join(sentence).strip().endswith(abbr) for abbr in ABBREVIATIONS
):
i += 1
break
i += 1
rest = tokens[i:]
first_sentence = "".join(sentence).strip()
rest_text = "".join(rest).strip()
new_lines = [first_sentence, ""]
if rest_text:
new_lines.append(rest_text)
new_lines.extend(line for line in lines[1:] if line)
return new_lines
This gives:
>>> split_summary(["First sentence is here. Second sentence is long", "and split in two. I even have a third sentence here.", "", "And other text here."])
['First sentence is here.',
'',
'Second sentence is long',
'and split in two. I even have a third sentence here.',
'And other text here.']
I do not know if the result should be processed more before returning or if it is something that is taken into account elsewhere in the codebase.
- Ngôn ngữ chính
- Python
- Star
- 598
- Fork
- 98
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PyCQA/docformatter
-
docformatter fix does not consider parameters for added newlinesCó thể đã có người làm @AtharvRG đã nhận 2 ngày trước. Đang mởfresh
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
PyCQA/docformatter#408 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BUG: Inconsistent behavior between `docformatter` and `black`Có thể đã có người làm @AtharvRG đã nhận 2 ngày trước. Đang mởfresh
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
PyCQA/docformatter#399 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
1.7.8 crashes with a tokenize ValueError on a multi-line f-string inside parenthesesCó thể làm lại được @adityaanikam đã nhận 83 ngày trước và không có pull request nào đang mở. Đang mởC: convention P: bug U: high
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
PyCQA/docformatter#367 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
1.7.8 rewrites the contents of a non-docstring triple-quoted string, silently changing its valueĐang mởC: convention P: bug U: high
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
PyCQA/docformatter#366 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
C: stakeholder P: enhancement U: low
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
PyCQA/docformatter#346 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PyCQA/docformatter
Issue tương tự
-
area:scripts area:tests bug priority:later
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Ikalus1988/MisakaNet#4358 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Discovered ports from service discovery are never propagated to modules in Module.load()Có thể đã có người làm @vishalmore90 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
OWASP/Nettacker#1828 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aws-samples/sample-per-model-bedrock#708 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[Performance] Bound resolve_api_hashes raw fallback reads to the 1 MiB region actually scannedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
sjkim1127/Reversecore_MCP#365 ·
Maintainer thường phản hồi trong vòng 1 ngày