Skip to content

[Feature Request] Make Clippy aspect apply to transitive dependencies #3607

@blorente

Description

@blorente

Currently, the clippy aspect doesn't traverse through deps edges. Therefore, if you build a rust_binary that depends on a rust_library and the rust_library has clippy issues, these won't be reported unless you also build the library.

To reproduce:

  1. Create this target in test/clippy/BUILD.bazel:
rust_binary(
    name = "bad_transitive_dep",
    srcs = ["src/main.rs"],
    edition = "2018",
    deps = [":bad_library"],
)
  1. Then, remove the noclippy tag from :bad_library.
  2. Run clippy:
  • bazel build --config=clippy test/clippy:bad_transitive_dep -> Succeeds
  • bazel build --config=clippy test/clippy:bad_library -> Fails
  • bazel build --config=clippy test/clippy:bad_library test/clippy:bad_transitive_dep -> Fails

I would have expected building :bad_transitive_dep to fail, since one of their dependencies fails.

I'm happy to implement the traversal functionality, but I wanted to check first before going deep into it: Is there any context I should be aware of? Is this against the philosophy of the the aspect?

I wasn't able to find anything in the Bazel slack or in the open issues, sorry if I missed anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions