danger-warnings_next_generation
This danger plugin generates overview and detail reports for code analysis results. 🕵️
This plugin is inspired and works only with the jenkins warnings-ng-plugin 🙇♂️
To avoid an overload of issues in the pull request, only issues for changed files are listed.
The overview report will always contain the number of total, new and fixed issues.
How it looks like
Warnings Next Generation Overview
Tool | 🪲 | ❌ | ✅ |
---|---|---|---|
Android Lint Warnings | 10 | 0 | 3 |
PMD Warnings | ⭐ | 0 | 0 |
Detekt Warnings | 10 | 5 | 5 |
Checkstyle Warnings | ⭐ | 0 | 3 |
Java Warnings
Severity | File | Description |
---|---|---|
NORMAL | ProductDetailPageFragment.kt:135 | [Deprecation] 'getColor(Int): Int' is deprecated. Deprecated in Java |
NORMAL | ImageGalleryFragment.kt:40 | Type mismatch: inferred type is java.util.ArrayList<String!>? but kotlin.collections.ArrayList /* = java.util.ArrayList */ was expected |
NORMAL | MyUtil.java:5 | [Design - HideUtilityClassConstructorCheck] 'getColor(Int): Int' is deprecated. Deprecated in Java |
As inline
Android Lint Warnings - NORMAL
[Correctness - GradleDependency]
Obsolete Gradle Dependency A newer version of com.android.support:design than 27.1.1 is available: 28.0.0 This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.
Installation
$ gem install danger-warnings_next_generation
Usage
Show overview and tool reports for all found analytic tools.warnings_next_generation.report
Show overview and tool reports for selected analytic toolswarnings_next_generation.report( # must match tool id include: ['android-lint', 'java', 'pmd'] )
Show overview and tool reports with inline commentswarnings_next_generation.report( inline: true, # inline comments require a baseline # file: "/var/lib/jenkins/workspace/projectname/repository/app/src/main/java/com/projectname/b2bshop/fragment/gallery/ImageGalleryFragment.kt # baseline: "/var/lib/jenkins/workspace/projectname/repository/ baseline: '/path/to/workspace/repository/root' )
Only overview reportwarnings_next_generation.overview_report( include: ['java'] )
Only tools reportwarnings_next_generation.tools_report( include: ['java', 'pmd'] inline: true, baseline: '/path/to/workspace/repository/root' )
Authentication
If you run a jenkins server with required authentication you can pass them to danger-warnings_next_generation
.
Create an API token with your CI user and do not pass normal password credentials.
Run all with authenticationwarnings_next_generation.report( auth_user: "jenkins", auth_token: "MY_TOKEN" )
Run overview with authenticationwarnings_next_generation.overview_report( auth_user: "jenkins", auth_token: "MY_TOKEN" )
Comments threshold
You can switch from inline comments to table comment if all issues >= threshold or to warnings if >= table threshold
Switch to table comment if combined issues size >= 15warnings_next_generation.report( inline: true inline_threshold: 15 )
Switch to table comment if combined issues size >= 200warnings_next_generation.report( table_threshold: 200 )
Switch from inline comment to table, and automatically to warning.warnings_next_generation.report( inline: true inline_threshold: 20 table_threshold: 200 )