Search code examples
androidandroid-studiointellij-ideaintellij-pluginandroid-lint

How is lint integrated with IntelliJ inspections in Android Studio?


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?


Solution

  • 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.