Idea for detecting (some) unused imports

20 views
Skip to first unread message

Ellen Spertus

unread,
Jul 19, 2018, 1:24:57 PM7/19/18
to Scalastyle users
I posted this comment on Issue 193 (Should capture the unused imports) but am not sure if people will see it, since the issue is closed.

Here's the idea I'd like feedback on...

I understand that it would be hard to tell if wildcard imports are unused, but would this work for non-wildcard imports?

To determine whether "import foo.bar.Baz" is useful, check wither "Baz" appears subsequently in the program:
  • not in an import
  • not in a comment
  • not in a String
  • not preceded by "foo.bar."
Reply all
Reply to author
Forward
0 new messages