RFC: improve diagnostic formatting
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
Hướng nghiên cứu
Start by reading the existing handling for --caret-diagnostic, -C/-A/-B, interactive mode, and --stdin_single_line; the issue does not name files or tests. Decide whether to introduce --format, which output formats and context behavior it should support, and how the interactive and stdin cases should work. Done means the discussion settles these design questions before implementation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In #3256 I introduced the --caret-diagnostic flag in order to report the diagnostic message as it is done by modern compilers.
The name of the flag is derived from https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fcaret-diagnostics (though I missed the ending s).
@peternewman suggested to add a --format flag, instead, in order to be future proof.
Since this requires more changes to the current code, I would like to open a discussion about the best strategy.
The main problem is how the context (-C/-A/-B) is applied. Here is an example:
: with fp:
: # GH-87235: On macOS all file descriptors for /dev/fd/N share the same
> # file offset, reset the file offset after scanning the zipfile diretory
: # to not cause problems when some runs 'python3 /dev/fd/9 9<some_script'
: start_offset = fp.tell()
Lib/zipimport.py:355: diretory ==> directory
This works only when there is one line.
--format flag
Introducing the --format flag has the advantage that we know how many context source lines are printed by a format, so with -C/-A/-B the code only needs to print additional lines around the lines printed by the format.
Possible formats:
plain (default)
if filename != "-":
f"{cfilename}:{cline}: {cwrongword} "
f"==> {crightword}{creason}"
else:
f"{cline}: {cwrongword} ==> {crightword}{creason}"
Not sure if ccolumn can be added.
diagnostic / caret-diagnostics / develop/ ?
if filename != "-":
f"{cfilename}:{cline}:{ccolumn}: {cwrongword} "
f"==> {crightword}{creason}\n"
f"{line}"
f"{ccaret}\n"
else:
f"{cfilename}:{cline}:{ccolumn}: {cwrongword} "
f"==> {crightword}{creason}\n"
f"{line}"
f"{ccaret}\n"
TODO
Not sure if the code in interactive mode should also be modified. Example:
: env['LC_ALL'] = 'C'
> # Empty strings will be quoted by popen so we should just ommit it
: if args != ('',):
# Empty strings will be quoted by popen so we should just ommit it
ommit ==> omit (Y/n)
The same line is printed twice; not sure if it is a good user experience.
Another issue I found is:
elif options.stdin_single_line:
print(f"{cline}: {cwrongword} ==> {crightword}{creason}")
else:
print(
f"{cline}: {line.strip()}\n\t{cwrongword} "
f"==> {crightword}{creason}"
)
Should we have the second template be an alternative format?
Should the --stdin_single_line flag be removed before the next release?
Thanks.
- Ngôn ngữ chính
- Python
- Star
- 2.4k
- Fork
- 531
- Merge trung bình
- 15 giờ 5 phút
- Pull request đã merge (30 ngày)
- 18
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
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 codespell-project/codespell
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
codespell-project/codespell#3997 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
No error when beginning with 'Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 63/100
codespell-project/codespell#3965 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add "marcos"Có thể đã có người làm @ekanshul đã nhận 19 ngày trước. Đang mởdictionary
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
codespell-project/codespell#3920 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
question
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
codespell-project/codespell#4005 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
duplicate question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
codespell-project/codespell#3998 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codespell-project/codespell
Issue tương tự
-
area/profiles comp/cli P3 type/feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
NousResearch/hermes-agent#146372 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] OpenAI-compatible embedding model alias breaks embedder constructionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Document obs-aw-automerge contract and fix automerge doc inconsistenciesCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
GeoSeries scale and skew tests fail with pytest 9.2.0Có thể đã có người làm @jiayuasu đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
admission-deferred priority: medium status: ready work-class: scoped
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
melodic-software/claude-code-plugins#10887 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày