How is lint integrated with IntelliJ inspections in Android Studio?

别等时光非礼了梦想. 提交于 2019-12-02 03:48:01

问题


I understand that there are two types of inspections in Android Studio, those which are inherited from IntelliJ and those which are inherited from lint (see: Android lint on command-line missing issue groups (versus options available in Android Studio)).

I also understand that when you write a custom lint rule and add it to an Android project it is automatically converted into an inspection.

Based on these two assertions I am lead to believe there is a mechanism which converts lint rules to IntelliJ inspections. In this article it states "Using the Structural Search Inspection is the only way to create custom inspections through the IntelliJ IDEA interface. Alternatively, you can develop an external plugin to implement a custom inspection.". So from this I gather that there must be a "lint plugin" which takes the lint rules and turns them into inspections.

So my question is, is this the case? If so, can someone point me to the source code of this plugin?


回答1:


Yes, this is basically correct. The code that adapts the Android linters to the IntelliJ inspections API lives here. It's not a separate plugin; it's part of the main Android plugin.



来源:https://stackoverflow.com/questions/40329926/how-is-lint-integrated-with-intellij-inspections-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!