-
Notifications
You must be signed in to change notification settings - Fork 259
[BUG] check-unused-code unexpected behavior when used with injectable lib #1196
Comments
Thank you for submitting the bug, looks like
You need to list the folders manually, there is no such thing as "autodiscoverability" for any folder, except lib. |
@ivan-semkin-gismart any chance you can create a repro? |
@incendial I will. Sorry for the delay, been busy at work |
No problem and thank you! Waiting for the repro then. |
(I am the same person that reported this issue initially) I finally figured this out. This only happens when the analyzed file is a |
https://github.com/vanyasem/dart-code-metrics-issue-repro I made an incredibly small reproduction there ^ There is no meaningful code there, you don't even need to launch it. It's just a default flutter counter app. It's specifically made to showcase an issue in Please do not run generation manually, the precompiled files are already included in the repo. You'd just need to |
Thanks for the repro! Good news that the Teams version works fine on this example. |
Fixed, thanks again for the report + repro. Will become available in the next release. |
thank you, much appreciated. I will close the issue for now, will reopen if I still manage to reproduce it later |
can confirm, the issue was fixed in 5.7.0. thank you once again |
Thank you, great to hear! |
Environment and configuration
DCM version:
5.5.1
Dart SDK version:
2.19.2
What did you do?
I have a project that consists of the main
lib/
folder, and several sub-packages incommon/
andstuff/
folders.When running
flutter pub run dart_code_metrics:metrics check-unused-code
with both--monorepo
and without it, the linter seemed to only analyze the contents of the main package (i.e. thelib/
folder).So I figured that I might use this command to achieve my desired result of analyzing all the subpackages by listing them manually:
flutter pub run dart_code_metrics:metrics check-unused-code lib common/ stuff/
And it did the trick. For some time at least.
What did you expect to happen?
I expected the tool to analyze my entire project.
What actually happened?
When used together with the
injectable
library,check-unused-code
marks the-Impl
classes instuff/
subpackage as unused, even though it's being referenced in the main package as folows:lib/di/injectors.config.dart
:stuff/example_data_holder.dart
:injectors.config.dart
is auto-generated, but does not follow the pattern specified in the docs:{/**.g.dart,/**.freezed.dart}
Participation
Additional comments
I'd also like to know whether my approach to analyzing all sub-packages is valid and correct.
Let me know if you need a more comprehensive sample, I will create a repo with a reproduction.
The text was updated successfully, but these errors were encountered: