Getting (almost) the same results when running AS inspections and gradle Lint

可紊 提交于 2019-12-11 08:16:12

问题


I have a similar issue than this one. I want to get the same results (as much as possible) when running code inspections from Android Studio and from a console Gradle task. When running from AS, I am using an xml Profile that defines some inspection tools, e.g:

<inspection_tool class="AndroidLintContentDescription" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="AndroidLintHardcodedText" enabled="true" level="INFO" enabled_by_default="true" />
<inspection_tool class="AndroidLintRegistered" enabled="true" level="INFO" enabled_by_default="true" />
<inspection_tool class="AnonymousClassComplexity" enabled="true" level="WARNING" enabled_by_default="true">

I am having big differences in results from AS and console (78 items in AS "Android Lint" section vs. 38 items in the console). How can I load this Profile when running Lint from console? Is this even possible?

Regards


回答1:


Android Lint is only a subset of the inspections that you can run in Android Studio/IntelliJ. If you want the same results in both, you should disable any non-Android-Lint inspections in Android Studio.




回答2:


You can run the Android Studio inspections from command line:

<android studio path>/bin/inspect.sh

https://www.jetbrains.com/idea/help/running-inspections-offline.html



来源:https://stackoverflow.com/questions/26222665/getting-almost-the-same-results-when-running-as-inspections-and-gradle-lint

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