bazel-contrib / bazel-contrib/rules_scala

Unused dependency checker reports actual rule instead of alias

Open
#875 31 comments 1 reaction 0 assignees View on GitHub
dep-tracking
Dominant language
Starlark
Stars
384
Forks
292
Avg merge
2d 21h
Merged PRs (30d)
46

Description

With the unused dependency checker, currently if there is an alias, the alias's target is printed in the error message instead. That is, in the following

```
scala_library(
name = "a",
srcs = ["A.scala"],
deps = [":b2"],
)

alias(
name = "b2",
actual = ":b"
)

scala_library(
name = "b",
srcs = ["B.scala"]
)
```

the error is

```
ERROR: XXX/bazel_play/BUILD.bazel:4:1: scala //:a failed (Exit 1)
error: Target '//:b' is specified as a dependency to //:a but isn't used, please remove it from the deps.
You can use the following buildozer command:
buildozer 'remove deps //:b' //:a
one error found
one error found
```

As opposed to complaining about ":b2".

This breaks buildozer as well as making it confusing for people.

Contributor guide

Open the contributing guide

Research direction

Reproduce the unused dependency checker behavior with the BUILD.bazel example in the issue, then trace how the checker reports an aliased dependency and generates the buildozer command. Done means the diagnostic and suggested removal command name :b2, the declared alias, rather than :b, its target.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.