lint 如何与 Android Studio 中的 IntelliJ 检查集成? [英] How is lint integrated with IntelliJ inspections in Android Studio?

查看:52
本文介绍了lint 如何与 Android Studio 中的 IntelliJ 检查集成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解Android Studio中有两种检查类型,一种是从IntelliJ继承的,另一种是从lint继承的(参见:命令行缺失问题组上的 Android lint(与 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)).

我也明白,当您编写自定义 lint 规则并将其添加到 Android 项目时,它会自动转换为检查.

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.

基于这两个断言,我相信有一种机制可以将 lint 规则转换为 IntelliJ 检查.在这篇文章中,它指出使用结构搜索检查是通过 IntelliJ IDEA 接口创建自定义检查的唯一方法.或者,您可以开发一个外部插件来实现自定义检查.".因此,我认为必须有一个lint 插件",它将 lint 规则转化为检查.

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?

推荐答案

是的,这基本上是正确的.使 Android linter 适应 IntelliJ 检查 API 的代码位于 此处.它不是一个单独的插件;它是主要 Android 插件的一部分.

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.

这篇关于lint 如何与 Android Studio 中的 IntelliJ 检查集成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆