I have a mixed Java / Kotlin project in Android studio with the usual bunch of androix libraries.
Is there an easy way (short of writing custom lint/detekt/ktlint rules) to essentially deprecate certain usages of third party libraries? Assuming I have no way of actually changing the code in the library itself.
For example, the library has a method foo
, I'd like all usages of that method to be flagged and break the build.
CodePudding user response:
There is a ForbiddenImport
rule in detekt.
# detekt.config
ForbiddenImport:
active: true
imports:
- 'kotlinx.android.synthetic.*'
- 'com.example.3rdParty'
You can also exclude some classes from auto-import and completion. Settings > Editor > General > Auto Import
This is just for developers not find the 'deprecated' or 'unwanted' imports easily.
Hope, it helps.