:wave: how would you change this to be compliant? ...
# detekt
j
👋 how would you change this to be compliant?
Dispatcher IO is used without dependency injection. [InjectDispatcher]
j
Copy code
class Example(private val dispatchers: Dispatchers) {
    ...
}
j
@Javier thx for the response. Just tried it, unfortunately this doesn’t change anything. I would also prefer not to switch to constructor injection in all places.
j
Why? Indeed construction injection is the way to go
I think construction injection should fix this, if not, you should report it
j
It should not make a difference if I inject it in the constructor or as local field as long as it is injected I comply to the guidelines. As said above, I tested it and it also does not work the other way. 🙂 I assume the issue is that I inject a whole bundle of dispatchers and not a single one as in the example: https://detekt.dev/docs/rules/coroutines/#injectdispatcher
if not, you should report it
Will do so.
a
I think this is false positive. We might have to allow `dispatchers`with
@Inject
annot and
dispatchers
with
inject
delegation(Somehow this part need to be generic rather than
koin
related)
@Jonas can you create an issue?
j
yes, will try to find the time today. 👍
a
Hi @Jonas I tried to add Tc(mentioned in the comment) and it is passing. Can you cross-check?
j
Sorry for getting back that late. I do not have the time to check atm. Will do so as soon as possible.
👍 1