Open Kukovec opened 2 years ago
@shonfeder for visibility.
I think we might need to annotate those imports with @nowarn("cat=unused-imports")
.
From the compiler's standpoint, it is completely right to warn about an unused import if that name only occurs in a comment. OTOH, we cannot disable -Ywarn-unused
, because Scalafix' RemoveUnused relies on those warnings.
@nowarn
is the best solution I can think of, but maybe someone has a better idea.
Is there no granularity between "unused imports" and "unused variables" for -Ywarn-unused
?
I suppose we could list them explicitly: https://docs.scala-lang.org/overviews/compiler-options/index.html#Warning_Settings
But we'd give up scalafix cleaning up unused imports across the codebase.
I don't think I would be in favor of any changes that reduced the quality of our linting or static analysis for the sake of making links in the API docs work. I'm also not in favor of importing modules just so we can reference in the docs, this seems to me like polluting our implementation for the sake of small, marginal utility in the API docs.
If you want a shorter way to refer to values, how about using @define
?: https://stackoverflow.com/a/32607798/1187277
If a scaladoc references e.g.
[[object]]
while using a top-levelimport a.b.c.object
, instead of[[a.b.c.object]]
, this triggers a compiler warning ("unused import") ifobject
is not used in the code. We should figure out how to treat documentation references as use cases, or relax the requirements on unused imports.