bazel-contrib / bazel-contrib/rules_scala
unused_dependency_checker false positives with _suite macros
Nobody has claimed this yet.
- Dominant language
- Starlark
- Stars
- 384
- Forks
- 292
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 46
Description
Unused dependency checker gives false positives when _suite macros are involved. Let's consider:
scala_library_suite(
name = "foo",
srcs = ["A.scala", "B.scala"],
deps = ["dep1", "dep2"],
)
A.scala depends on dep1 and B.scala depends on dep2. In this scenario, both dep1 and dep2 will be reported as unused. It's because _suite is expanded into several targets with deps copied to each of them.
Users' expectation here is that dependency is reported as an unused only when it's not used in all srcs from the suite but now it's reported if it's unused in some source from the suite. Fixing this would require a post-processing step that takes union of deps information from all expanded targets of the suite.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the unused dependency checker and how _suite macros expand into targets with copied deps. Reproduce the scala_library_suite example, then verify that a dependency is reported unused only when it is unused across all sources in the suite, using the union of dependency information from the expanded targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100