Lint files of a gradle based Android project.
$ gem install danger-android_lint
Add the following line to your Gemfile and then run bundle install:
gem 'danger-android_lint'Before all, you need to turn lint reports on in your build.gradle file. You can do this by adding the xmlReport true option, like:
android {
lintOptions {
xmlReport true
}
}android_lint.lintIn case you have multiple flavors, you may want to change the gradle task that runs the lint command. You can achieve that by simply changing the value of gradle_task. Default is lint.
android_lint.gradle_task = "lintMyFlavorDebug"
android_lint.lintIf you want to skip the gradle task execution. You can achieve that by simply changing the value of skip_gradle_task. Default is false.
android_lint.skip_gradle_task = true
android_lint.lintIf you're using a path to output your report file other than the default one, you can specify it by setting a new value to report_file:
android_lint.report_file = "your/report/file.xml"
android_lint.lintIf you want to filter lint issues based on their severity level, you can do that by setting a value to severity. Bear in mind that you are filtering issues by the severity level you've set and up. Possible values are Warning, Error and Fatal. Default is Warning (which is everything).
android_lint.severity = "Error"
android_lint.lintIf you're dealing with a legacy project, with tons of warnings, you may want to lint only new/modified files. You can easily achieve that, setting the filtering parameter to true.
android_lint.filtering = true
android_lint.lintAdditionally, you can further filter to only the modified lines by setting the filtering_lines parameter to true.
android_lint.filtering_lines = true
android_lint.lintIn some cases you may want to conditionally ignore specific lint warnings without fully disabling
them in your lintOptions configuration. To do that, you can pass a list of IDs to the
excluding_issue_ids parameter.
android_lint.excluding_issue_ids = ["MissingTranslation"]
android_lint.lintandroid_lint.lint(inline_mode: true)- Clone this repo
- Run
bundle installto setup dependencies. - Run
bundle exec rake specto run the tests. - Use
bundle exec guardto automatically have tests run as you make changes. - Make your changes.