diff --git a/Dangerfile b/Dangerfile new file mode 100644 index 000000000..97075ef7a --- /dev/null +++ b/Dangerfile @@ -0,0 +1,44 @@ +github.dismiss_out_of_range_messages + +# Make it more obvious that a PR is a work in progress and shouldn't be merged yet. +has_wip_label = github.pr_labels.any? { |label| label.include? "Engineers at work" } +has_wip_title = github.pr_title.include? "[WIP]" + +if has_wip_label || has_wip_title + warn("PR is marked as Work in Progress") +end + +# Ensure the PR is not marked as DO NOT MERGE +fail("PR specifies label DO NOT MERGE") if github.pr_labels.any? { |label| label.include? "DO NOT MERGE" } + +# Warn when there is a big PR +warn("Big PR") if git.lines_of_code > 5000 + +File.open("settings.gradle", "r") do |file_handle| + file_handle.each_line do |setting| + if setting.include? "include" + gradleModule = setting[10, setting.length-12] + + # AndroidLint + androidLintFile = String.new(gradleModule + "/build/reports/lint-results.xml") + + if File.file?(androidLintFile) + android_lint.skip_gradle_task = true + android_lint.severity = "Warning" + android_lint.report_file = androidLintFile + android_lint.filtering = true + android_lint.lint(inline_mode: true) + end + + # Detekt + detektFile = String.new(gradleModule + "/build/reports/detekt.xml") + if File.file?(detektFile) + kotlin_detekt.report_file = detektFile + kotlin_detekt.skip_gradle_task = true + kotlin_detekt.severity = "warning" + kotlin_detekt.filtering = true + kotlin_detekt.detekt(inline_mode: true) + end + end + end +end \ No newline at end of file diff --git a/Gemfile b/Gemfile index 66b5d8c18..f2dcc83ff 100644 --- a/Gemfile +++ b/Gemfile @@ -1 +1,9 @@ -gem "jekyll-readme-index" \ No newline at end of file +# frozen_string_literal: true + +source "https://rubygems.org" + +git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } + +gem 'danger' +gem 'danger-android_lint' +gem 'danger-kotlin_detekt' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 000000000..f34f53a2c --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,78 @@ +GEM + remote: https://rubygems.org/ + specs: + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + ansi (1.5.0) + ast (2.4.1) + claide (1.0.3) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) + colored2 (3.1.2) + cork (0.3.0) + colored2 (~> 3.1) + danger (8.0.5) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 2.0) + faraday-http-cache (~> 2.0) + git (~> 1.7) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + no_proxy_fix + octokit (~> 4.7) + terminal-table (~> 1) + danger-android_lint (0.0.8) + danger-plugin-api (~> 1.0) + oga + danger-kotlin_detekt (0.0.3) + danger-plugin-api (~> 1.0) + danger-plugin-api (1.0.0) + danger (> 2.0) + faraday (1.0.1) + multipart-post (>= 1.2, < 3) + faraday-http-cache (2.2.0) + faraday (>= 0.8) + git (1.7.0) + rchardet (~> 1.8) + kramdown (2.3.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + multipart-post (2.1.1) + nap (1.1.0) + no_proxy_fix (0.1.2) + octokit (4.18.0) + faraday (>= 0.9) + sawyer (~> 0.8.0, >= 0.5.3) + oga (3.3) + ast + ruby-ll (~> 2.1) + open4 (1.3.4) + public_suffix (4.0.6) + rchardet (1.8.0) + rexml (3.2.4) + ruby-ll (2.1.2) + ansi + ast + sawyer (0.8.2) + addressable (>= 2.3.5) + faraday (> 0.8, < 2.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + unicode-display_width (1.7.0) + +PLATFORMS + ruby + +DEPENDENCIES + danger + danger-android_lint + danger-kotlin_detekt + +BUNDLED WITH + 2.1.4