Skip to content

Support per-crate clippy.toml via lint_config #4113

Description

@AlokSwaminathan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions