rickclephas / KMP-NativeCoroutines

Library to use Kotlin Coroutines from Swift code in KMP apps
MIT License
1.06k stars 31 forks source link

Detekt rule for detecting suspend functions and flows declarations, exposed to Obj-C #140

Open Pschsch opened 1 year ago

Pschsch commented 1 year ago

Would be useful for teams who use this so popular analyzer

rickclephas commented 1 year ago

As of version 1.0.0-ALPHA-16, such checks are built into the compiler plugin. Together with the IDE plugin those warnings (or errors) are also shown in the IDE.

What would be the added benefit of a Detekt rule?

vanniktech commented 1 year ago

I've also seen this warning but I've ignored it. What's the proper way to fix this?

rickclephas commented 1 year ago

@vanniktech you can either ignore specific declarations explicitly, or you can disable the check altogether.

Pschsch commented 1 year ago

We want to throw an error if suspend and flow exposed to obj-c without plugin to clean up domain layer, because we want apply plugin only on ViewModel layer. With detekt we could achieve this automatically to avoid manual validating. As the alternative, kmp-native-coroutines plugin could provide plugin extension with flow declarations exposing compiler error level: warning or error. What do you think about this way?