Context of lint.xml and inspection profile

后端 未结 1 739
旧时难觅i
旧时难觅i 2020-12-31 05:41

In Android Studio there is the lint.xml configuration and ./idea/inspectionProfiles/.xml manageable via Settings => Editor => Inspections. I under

相关标签:
1条回答
  • 2020-12-31 06:00

    I can sum up my research so far.

    1.) Inspection Profile is extending lint.xml, so the number of lint.xml rules is smaller than the number of Inspection profile rules. The current lint.xml ruleset can be found here.

    2.) When you have defined a lint.xml, in your Android Studio you can go to File => Settings => Editor => Inspections and use the Manage => Import dropdown towards your lint.xml. This will set all rule outside lint.xml to be deactivated.

    I don't know of any way for convert from InspectionProfile into lint.xml.

    3.) See 1.), Inspection Profile is extending lint.xml.

    4.) As Inspection Profile is locally used and inside Android Studio, it is executed during runtime in the editor and on commit when analysis is checked. Your lint.xml is usually located in the project's root and submitted into SVN/GIT. Then your configuration server (Jenkins, QuickBuild etc.) can have a designated task to run this lint.xml and process its output.

    Additional, helpful things:

    • You can run gradlew lint from the Terminal inside Android Studio. It will create a html page at /build/outputs/lint-results-debug.html or at any file position specified.
    • When you open a lint.xml file in your Android Studio editor, a lot of content assist is provided for the rules. Nevertheless there seems to be a gap in the rulesets, as e.g. Convert2Lambda is in the example lint.xml, but not in the official documentation.

    • Despite that it is generally a bad idea to put ./idea under version control, for team distibution you can submit your Inspection Profile at /.idea/inspectionProfiles/MyInspectionProfile.xml and put every other file inside /.idea on ignore. There is an article on this topic I cannot find anymore, but this solution works like a charm for my team.

    0 讨论(0)
提交回复
热议问题