Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gianluz/danger-kotlin-android-lint-plugin
Show the Android lint errors with Danger
https://github.com/gianluz/danger-kotlin-android-lint-plugin
android android-lint danger danger-kotlin danger-plugin kotlin
Last synced: about 1 month ago
JSON representation
Show the Android lint errors with Danger
- Host: GitHub
- URL: https://github.com/gianluz/danger-kotlin-android-lint-plugin
- Owner: gianluz
- License: apache-2.0
- Created: 2019-08-11T15:48:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-18T17:20:46.000Z (over 4 years ago)
- Last Synced: 2024-08-03T14:07:44.653Z (5 months ago)
- Topics: android, android-lint, danger, danger-kotlin, danger-plugin, kotlin
- Language: Kotlin
- Size: 152 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-danger - danger-kotlin-android-lint-plugin - Show the android lint errors (Plugins / Kotlin (danger-kotlin))
README
[![Maven Central](https://img.shields.io/maven-central/v/com.gianluz/danger-kotlin-android-lint-plugin.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.gianluz%22%20AND%20a:%22danger-kotlin-android-lint-plugin%22)
[![Build Status](https://travis-ci.org/gianluz/danger-kotlin-android-lint-plugin.svg?branch=master)](https://travis-ci.org/gianluz/danger-kotlin-android-lint-plugin)
# danger-kotlin-android-lint-pluginShow the Android lint errors on your PR with [Danger Kotlin]
## Setup
Install and run [Danger Kotlin] as normal and in your `Dangerfile.df.kts` add the following dependency:
```kotlin
@file:DependsOn("com.gianluz:danger-kotlin-android-lint-plugin:0.1.0")
```
Then register your plugin before the `danger` initialisation and use the plugin:
```kotlin
register plugin AndroidLintval danger = Danger(args)
// Default report
AndroidLint.report("/path/to/the/androidlint/result/file.xml")
```
You can report more than one lint file.You can also keep tidy your `DangerFile.df.kts` using the following block:
```kotlin
androidLint {
[...]
}
```
Or make your own custom report by manipulating all the issues found, for example failing the build at the first `Fatal` found in a specific module.
```kotlin
androidLint {
// Fail for each Fatal in a single module
val moduleLintFilePaths = find(
moduleDir,
"lint-results-debug.xml",
"lint-results-release.xml"
).toTypedArray()parseAllDistinct(*moduleLintFilePaths).forEach {
if(it.severity == "Fatal")
fail(
"Danger lint check failed: ${it.message}",
it.location.file.replace(System.getProperty("user.dir"), ""),
Integer.parseInt(it.location.line)
)
}
}
```## Configuration for the default report
You can customise the aspect of your default reports defining the configuration file `androidlint.dangerplugin.yml`
```yaml
logLevel: WARNING
format: "{severity}: {message}"
failIf:
warnings: 3
errors: 1
fatals: 1
total: 3
```#### Accepted values are:
| **SETTING** | **DESCRIPTION** | **DEFAULT** | **ACCEPTED VALUES** |
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------|:-------------------------------------:|--------------------------------------------------------------------------------------------------------------------------------|
| `logLevel` | Report all the lints with `severity` >= `logLevel` | `WARNING` | `WARNING, ERROR, FATAL` |
| `format` | Define a custom message for your lints | `"{severity}: {message}"` | `{id}, {severity}, {message}, {category}`,
`{priority}, {summary}, {explanation}, {url},`
`{urls}, {errorLine1}, {errorLine2}` |
| `failIf` | Fail your PR if the condition is satisfied:
for example in this case will fail if there are at least:
3 warnings or 1 error or 1 fatal. | `warnings: 3`
`errors: 1`
`fatals: 1` | `warnings: Int`
`errors: Int`
`fatals: Int`
`total: Int` |[Danger Kotlin]:https://github.com/danger/kotlin