Support per-crate `clippy.toml` via `lint_config`

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

Maintainer thường phản hồi trong vòng 3 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
58/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
build-system

Hướng nghiên cứu

Đọc rust/private/clippy.bzl quanh L281-L285, sau đó lần theo cơ chế lint_config/LintsInfo hiện có, cơ chế cung cấp các cờ Clippy cho từng target. Thay đổi được hoàn tất khi các crate hoặc target riêng lẻ có thể cung cấp clippy.toml riêng của chúng, đồng thời cấu hình hiện có trên toàn workspace vẫn được hỗ trợ.

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

Mô tả

Note: I'm willing to write the PR for this feature, just posting an issue to get maintainer feedback first

Problem

The clippy aspect currently uses a single global clippy.toml for the entire workspace. There is no way for individual crates to provide their own clippy configuration file.

This matters for lints like disallowed-types, too-many-arguments-threshold, type-complexity-threshold, etc. that require clippy.toml for their configuration. A workspace with many crates often needs different thresholds or disallowed-type lists per crate, but today the only option is a single workspace-wide config.

Root cause

The clippy aspect hardcodes CLIPPY_CONF_DIR from a single private attribute:

rust/private/clippy.bzl L281-285:

"_config": attr.label(
    doc = "The `clippy.toml` file used for configuration",
    allow_single_file = True,
    default = Label("//rust/settings:clippy.toml"),
),

Proposed solution

Extend the existing lint_config / LintsInfo mechanism to support a per-target clippy config file. This is the natural place since lint_config already provides per-target clippy flags.

Ngôn ngữ chính
Starlark
Star
857
Fork
701
Merge trung bình
4 ngày 7 giờ
Pull request đã merge (30 ngày)
46

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 bazelbuild/rules_rust

Tất cả issue của bazelbuild/rules_rust

Issue tương tự

Thêm issue về Build System

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.