Skip to content

Unused traits are not beign reported #158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
klapuch opened this issue Mar 7, 2025 · 1 comment
Open

Unused traits are not beign reported #158

klapuch opened this issue Mar 7, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@klapuch
Copy link

klapuch commented Mar 7, 2025

Hello,

Thank you for providing a great set of rules! We've encountered an unexpected behavior, and I'd like to discuss whether this is intentional or if there's something we can do about it.

The issue relates to traits. When we use a trait from a third-party package (a "vendor" package) without actually using any of its methods, no error is raised—regardless of method visibility. However, when we use our own traits within the project, unused methods are correctly reported. I would expect the same behavior for vendor traits as our project traits.

To illustrate this, I've prepared a minimal demo: https://github.com/klapuch/DeadCodeTest

Thank you!

@janedbal
Copy link
Member

janedbal commented Mar 7, 2025

It looks like you are looking for detection of "unused trait use". Currently, there is no such thing, we only detect dead methods and dead constants so far. Thus, we do not report unused things in vendor as you cannot really remove the method from there.

But thanks for the idea, we can consider implementing this in future.

@janedbal janedbal added the enhancement New feature or request label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants