Performance suggestion: do not run unselected plugins/checks
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ó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- performance, tooling
Hướng nghiên cứu
Bắt đầu trong src/flake8/checker.py, đặc biệt là FileChecker và đường dẫn thực thi plugin được thể hiện trong issue, rồi theo dõi cách --select được áp dụng sau khi các phép kiểm tra chạy xong. So sánh quá trình thực thi chi tiết có và không có --select; được xem là hoàn tất khi các phép kiểm tra hoặc plugin không được chọn bị bỏ qua, trong khi các chẩn đoán được chọn vẫn chính xác và thời gian chạy được cải thiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In GitLab by @hugovk on Jun 5, 2020, 01:45
Please read this brief portion of documentation before going any further: http://flake8.pycqa.org/en/latest/internal/contributing.html#filing-a-bug
Please describe how you installed Flake8
$ pip install -U flake8
$ brew install flake8
# etc.
Please provide the exact, unmodified output of flake8 --bug-report
{
"dependencies": [],
"platform": {
"python_implementation": "CPython",
"python_version": "3.8.3",
"system": "Darwin"
},
"plugins": [
{
"is_local": false,
"plugin": "flake8_2020",
"version": "1.6.0"
},
{
"is_local": false,
"plugin": "mccabe",
"version": "0.6.1"
},
{
"is_local": false,
"plugin": "pycodestyle",
"version": "2.6.0"
},
{
"is_local": false,
"plugin": "pyflakes",
"version": "2.2.0"
}
],
"version": "3.8.2"
}
Please describe the problem or feature
I noticed that Flake8 takes the same time to run with --select as without. As shown using -vv verbosity, it runs all the plugins and checks regardless of --select, and only reports the selected ones afterwards.
Flake8 can sometimes take a long time to run on large codebases, and if it was possible to only run the selected checks, that would save a lot of time, CPU and power.
Would it be possible to only run selected checks/plugins? Rather than running them anyway and discarding that work when reporting?
Docs
For reference, my emphasis.
flake8 --help says --select is for which ones to enable:
--select errors Comma-separated list of errors and warnings to enable. For example, ``--select=E4,E51,W234``.
(Default: ['E', 'F', 'W', 'C90'])
The docs are a bit more explicit:
Specify the list of error codes you wish Flake8 to report.
https://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-select
Example
An example running on the TensorFlow codebase:
$ time flake8
...
flake8 323.91s user 4.31s system 98% cpu 5:32.78 total
$ time flake8 --select YTT
...
flake8 --select YTT 318.62s user 3.80s system 99% cpu 5:25.51 total
Both about the same, around 5m20s.
With an ugly hack (I know this mixes plugin names with error codes, but it's just to get a rough idea, and there's other places to skip too):
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index d993cb9..9ed986d 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -486,6 +486,8 @@ class FileChecker(object):
return
for plugin in self.checks["ast_plugins"]:
+ if plugin["name"] != "YTT":
+ continue
checker = self.run_check(plugin, tree=ast)
# If the plugin uses a class, call the run method of it, otherwise
# the call should return something iterable itself
$ time flake8 --select YTT
flake8 --select YTT 276.90s user 3.17s system 98% cpu 4:43.00 total
About 4m30s, nearly a minute and ~13% faster.
- Ngôn ngữ chính
- Python
- Star
- 3.8k
- Fork
- 363
- Merge trung bình
- 2 giờ 53 phút
- Pull request đã merge (30 ngày)
- 10
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/flake8
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
PyCQA/flake8#2062 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Max Line Length in style guide ignored with python 3.14 when checking multiple filesCó 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 45/100
PyCQA/flake8#2011 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
PyCQA/flake8#1793 · 9 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
PyCQA/flake8#1774 · 13 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
option_manager.add_option ignores action when reading from configCó 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 35/100
PyCQA/flake8#1770 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
huggingface/smolagents#2976 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pulp-cli 0.41 break username password auth in older configs (cert and key present but empty)Đang mởbug Triage-Needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
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 66/100
FuRongJun-1999/dsh-memory#170 ·
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
pgvector/pgvector-python#163 ·
-
[开源推荐] 打拼音就出篆书的输入法,附古文字创作小工具Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
521xueweihan/HelloGitHub#3940 ·