gradle-lint-plugin icon indicating copy to clipboard operation
gradle-lint-plugin copied to clipboard

Improve unused-dependency "required by your code" output to include relevant classes

Open devminded opened this issue 8 years ago • 3 comments

Today the output looks like this:

error     unused-dependency                  one or more classes in org.springframework:spring-core:4.3.7.RELEASE are required by your code directly

It would be beneficial to have a more detailed output.

error     unused-dependency                  one or more classes in org.springframework:spring-core:4.3.7.RELEASE are required by your code directly
  unused-dependency: org.springframework.util.ClassUtils is used by se.devmind.UsingTransitiveDep
  unused-dependency: org.springframework.util.Foo is used by se.devmind.Bar
  ...

devminded avatar Mar 31 '17 21:03 devminded

I just added something similar to the duplicate-dependency-class rule when it's run at --info level. The violations aren't really designed with multi-line output in mind, so it'll either take a little work to support that, or we add it as separate logging like we did for the duplicate rule.

DanielThomas avatar Mar 31 '17 21:03 DanielThomas

Yes, that would work.

I think I would prefer if the output used the term 'transitive dependency' instead of just the very confusing name of the rule: 'unused-dependency'. Maybe even split it into two rules?

error     transitive-dependency                  one or more classes in org.springframework:spring-core:4.3.7.RELEASE are required by your code directly
  - org.springframework.util.ClassUtils is used by se.devmind.UsingTransitiveDep
  - org.springframework.util.Foo is used by se.devmind.Bar
  ...

devminded avatar Apr 01 '17 19:04 devminded

"Transitive-dependency" is soooo much better, I just came here trying to figure out what on earth gradle was complaining about :-)

grandinj avatar Aug 17 '20 09:08 grandinj