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

未关闭
#4,113 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
rust
领域
build-system

调研方向

阅读 rust/private/clippy.bzl 中 L281-L285 附近的内容,然后跟踪现有的 lint_config/LintsInfo 机制,该机制负责提供按 target 区分的 Clippy 标志。当单个 crate 或 target 可以提供自己的 clippy.toml,同时仍支持现有的 workspace 级配置时,此更改即完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Starlark
星标
857
派生
701
平均合并
4 天 7 小时
30 天内合并 PR
46

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bazelbuild/rules_rust 的其他 Issue

查看 bazelbuild/rules_rust 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。