E306: False positive when preceded by 2 blank lines and a comment
Chưa có ai nhận issue này.
Đá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
Lưu các ví dụ được cung cấp dưới dạng bug.py và chạy pycodestyle --select=E306 --show-source bug.py để tái hiện hai false positive. Đọc entry point của bộ kiểm tra E306 trong tệp Python duy nhất của dự án, sau đó xác minh rằng các định nghĩa lồng nhau đứng trước bởi comment và dòng trống không còn báo cáo E306, trong khi các trường hợp hiện có vẫn giữ nguyên hành vi mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
$ pycodestyle --version
2.7.0
If you have two blank lines, a comment, and then a nested function, E306 is raised erroneously.
(Since this false positive requires a genuine violation of E303, I don't think it's a big deal. But I noticed it, so I'm reporting it.)
The following functions both trigger false postives for E306.
def bad():
_ = None
# arbitrary comment
def inner(): # E306 not expected (but happening! 1/2)
pass
def bad():
_ = None
# arbitrary comment
def inner(): # E306 not expected (but happening! 2/2)
pass
For context, this snippet contains the false positives as well as cases that don't trigger E306:
def bad():
_ = None
# arbitrary comment
def inner(): # E306 not expected (but happening! 1/2)
pass
def bad():
_ = None
# arbitrary comment
def inner(): # E306 not expected (but happening! 2/2)
pass
def good():
_ = None
# arbitrary comment
def inner(): # E306 not expected
pass
def good():
_ = None
# arbitrary comment
def inner(): # E306 not expected
pass
def good():
_ = None
# arbitrary comment
def inner(): # E306 not expected
pass
If you dump that to a file (e.g., bug.py) and run pycodestyle on it, you'll get E306 inside the two bad() functions:
$ pycodestyle --select=E306 --show-source bug.py
bug.py:7:5: E306 expected 1 blank line before a nested definition, found 0
def inner(): # E306 not expected (but happening! 1/2)
^
bug.py:16:5: E306 expected 1 blank line before a nested definition, found 0
def inner(): # E306 not expected (but happening! 2/2)
^
Let me know if there's anything I can clarify/provide, thanks!
- Ngôn ngữ chính
- Python
- Star
- 5.2k
- Fork
- 760
- Merge trung bình
- 8 giờ 11 phút
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọ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 PyCQA/pycodestyle
-
DOC: E252 is not documentedĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
PyCQA/pycodestyle#1294 · 1 bình luận ·
-
Typing and formattingĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
PyCQA/pycodestyle#1302 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
PyCQA/pycodestyle#1242 · 2 bình luận ·
-
Spurious E231 for nested format substitutionsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
PyCQA/pycodestyle#1241 · 2 bình luận · 4 reaction ·
-
`exclude` is applied to `.`Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
PyCQA/pycodestyle#1217 ·
Tất cả issue của PyCQA/pycodestyle
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
infrastructure qa
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
khuisman/mcp-gee-sweet#1068 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The book has a Nix install section that chelis.ch lacks, and it names two of the three systemsĐang mởarea:ecosystem documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Chelis-Lang/chelis#3866 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`lvm_compact` has no self-hosted twin, and `docs/158` §5 says every language-face component mustĐang mởbug sev-3 vm
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
issue: Picking a prompt from the / menu in a channel inserts a command chip instead of the promptĐang mởbug confirmed issue
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 78/100
open-webui/open-webui#32712 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày