Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Rework specifying and layering of configuration

Đang mở
#332 9 bình luận 1 reaction 0 người được giao Xem trên GitHub

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
25/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
cli, tooling

Hướng nghiên cứu

Bắt đầu bằng cách lần theo quá trình phân tích CLI, tải tệp cấu hình và các đường dẫn phân lớp cấu hình của flake8; issue không nêu tên các tệp hoặc test cụ thể. So sánh hành vi hiện tại với từng ví dụ shell, sau đó xác định thứ tự phân tích và các quy tắc ưu tiên cần thiết cho việc lặp lại --config, loại bỏ --append-config và xử lý --isolated. Được coi là hoàn tất khi các hành vi được liệt kê đã được triển khai và xác minh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In GitLab by @ericvw on Dec 29, 2019, 07:30

After having spent some time making changes in CLI parsing, the configuration
file loading, and the layering of the configuration options, I would like to
simplify how configuration gets specified and layered. I wanted to raise this
issue for awareness and discussion before proceeding with this larger goal.

The user-facing would be the following:

  • Allow --config to be used multiple times for specifying configuration
    files. Options in subsequent --config file take precedence. The command
    line arguments in the configuration files will be used as if they were
    provided first on the command line before other options that are specified on
    the command line.
  • Remove --append-config in favor of --config now that --config can be
    specified multiple times.
  • Keep --isolated to ignore the automatic detection of configuration (i.e.,
    user configuration and the searching-up-the-paths configuration). However,
    --config may be specified with --isolated to provide files to be parsed.

Below are the behaviors expected if the above changes were implemented:

# Configuration options found in the user's config path followed by
# configuration options found locally taking precedence.
flake8 file1.py file2.py

# Same as above with options in 'config.ini' taking precedence.
flake8 --config config.ini file1.py file2.py

# The '--max-line-length 99' takes precedence over the option specified in
# any configuration file.
flake8 --max-line-length 99 --config config.ini file1.py file2.py

# Configuration options in 'config2.ini' takes precedence over those in 'config1.ini'.
flake8 --config config1.ini --config2.ini file1.py file2.py

# Configuration options in 'config1.ini' takes precedence over those in 'config2.ini'.
flake8 --config2.ini --config config1.ini file1.py file2.py

# Default configuration is used and not read from the user's config path nor
# detecting local configuration.
flake8 --isolated file1.py file2.py

# Same as above, however, configuration options in 'config.ini' are used as if they were
# specified on the command line.
flake8 --isolated --config 'config.ini' file1.py file2.py

With these changes, the benefits are the following:

  • Configuration files from --config are just appended to a single list to be
    parsed. If --isolated is not specified, elide the user and local files
    included in the list of configuration files to parse.
  • Handling of single configuration and what is considered "appended"
    configuration is exactly the same.
  • With --isolated present, there is still an elegant way to specify a set of
    configuration options via file without having to put them all on the command
    line.

The following trade-offs are the following:

  • The changes are backward-incompatible.
    • Removal of --append-config.
    • Changing the behavior of --isolated to allow --config in addition to.
    • Change the behavior of --config to be specified multiple times.

@asottile and @sigmavirus24, would greatly appreciate your input and feedback
before I proceed forward. Thanks!

Ngôn ngữ chính
Python
Star
3.8k
Fork
363
Merge trung bình
3 giờ 59 phút
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PyCQA/flake8

Tất cả issue của PyCQA/flake8

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.