A platform for community discussion. Free, open, simple.
DEV: implementing danger for travis
Joffrey JAFFEUXb4a2f3fe2fd4
diff --git a/.travis.yml b/.travis.ymlindex 728ef56cd05..67044b9485a 100644--- a/.travis.yml+++ b/.travis.yml@@ -72,7 +72,7 @@ script:- |bash -c "if [ '$RUN_LINT' == '1' ]; then- bundle exec rubocop --parallel && \+ bundle exec danger && \eslint --ext .es6 app/assets/javascripts && \eslint --ext .es6 test/javascripts && \eslint --ext .es6 plugins/**/assets/javascripts && \diff --git a/Dangerfile b/Dangerfilenew file mode 100644index 00000000000..a3934b51a7d--- /dev/null+++ b/Dangerfile@@ -0,0 +1,29 @@+require 'json'++if git.lines_of_code > 500+ warn("This PR seems big, we prefer smaller PR. Please be sure this is needed and can’t be split in smaller commits.")+end++rubocop_output = `bundle exec rubocop --parallel`+if !rubocop_output.empty?+ offenses = JSON.parse(rubocop_output)['files']+ .select { |f| f['offenses'].any? }++ fail(%{+ This PR has multiple rubocop offenses:++ #{offenses.join("\n")}+ })+end++prettier_output = `prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6" "plugins/**/*.scss" "plugins/**/*.es6"`+if !prettier_output.empty?+ offenses = JSON.parse(prettier_output)['files']+ .select { |f| f['offenses'].any? }++ fail(%{+ This PR has multiple prettier offenses:++ #{offenses.join("\n")}+ })+enddiff --git a/Gemfile b/Gemfileindex 95e20d4cf65..3ec355c0a8f 100644--- a/Gemfile+++ b/Gemfile@@ -108,6 +108,7 @@ group :test dogem 'webmock', require: falsegem 'fakeweb', '~> 1.3.0', require: falsegem 'minitest', require: false+ gem 'danger'endgroup :test, :development dodiff --git a/Gemfile.lock b/Gemfile.lockindex dc24ed1b27f..2118599739d 100644--- a/Gemfile.lock+++ b/Gemfile.lock@@ -76,13 +76,33 @@ GEMbyebug (10.0.2)certified (1.0.0)chunky_png (1.3.10)+ claide (1.0.2)+ claide-plugins (0.9.2)+ cork+ nap+ open4 (~> 1.3)coderay (1.1.2)+ colored2 (3.1.2)concurrent-ruby (1.0.5)connection_pool (2.2.2)+ cork (0.3.0)+ colored2 (~> 3.1)cppjieba_rb (0.3.0)crack (0.4.3)safe_yaml (~> 1.0.0)crass (1.0.4)+ danger (5.6.3)+ claide (~> 1.0)+ claide-plugins (>= 0.9.2)+ colored2 (~> 3.1)+ cork (~> 0.1)+ faraday (~> 0.9)+ faraday-http-cache (~> 1.0)+ git (~> 1)+ kramdown (~> 1.5)+ no_proxy_fix+ octokit (~> 4.7)+ terminal-table (~> 1)debug_inspector (0.0.3)diff-lcs (1.3)discourse_image_optim (0.26.2)@@ -113,6 +133,8 @@ GEMfakeweb (1.3.0)faraday (0.12.2)multipart-post (>= 1.2, < 3)+ faraday-http-cache (1.3.1)+ faraday (~> 0.8)fast_blank (1.0.0)fast_xor (1.1.3)rake@@ -125,6 +147,7 @@ GEMthor (~> 0.19.1)fspath (3.1.0)gc_tracer (1.5.1)+ git (1.4.0)globalid (0.4.1)activesupport (>= 4.2.0)guess_html_encoding (0.0.11)@@ -147,6 +170,7 @@ GEMthor (>= 0.14, < 2.0)jwt (1.5.6)kgio (2.11.2)+ kramdown (1.17.0)libv8 (6.7.288.46.1)listen (3.1.5)rb-fsevent (~> 0.9, >= 0.9.4)@@ -189,6 +213,8 @@ GEMmulti_xml (0.6.0)multipart-post (2.0.0)mustache (1.0.5)+ nap (1.1.0)+ no_proxy_fix (0.1.2)nokogiri (1.8.3)mini_portile2 (~> 2.3.0)nokogumbo (1.5.0)@@ -200,6 +226,8 @@ GEMmulti_json (~> 1.3)multi_xml (~> 0.5)rack (>= 1.2, < 3)+ octokit (4.9.0)+ sawyer (~> 0.8.0, >= 0.5.3)oj (3.6.2)omniauth (1.8.1)hashie (>= 3.4.6, < 3.6.0)@@ -235,6 +263,7 @@ GEMmustachenokogiri (~> 1.7)sanitize+ open4 (1.3.4)openid-redis-store (0.0.2)redisruby-openid@@ -354,6 +383,9 @@ GEMbundlerffi (~> 1.9.6)sass (>= 3.3.0)+ sawyer (0.8.1)+ addressable (>= 2.3.5, < 2.6)+ faraday (~> 0.8, < 1.0)seed-fu (2.3.9)activerecord (>= 3.1)activesupport (>= 3.1)@@ -378,6 +410,8 @@ GEMsprockets (>= 3.0.0)sshkey (1.9.0)stackprof (0.2.11)+ terminal-table (1.8.0)+ unicode-display_width (~> 1.1, >= 1.1.1)thor (0.19.4)thread_safe (0.3.6)tilt (2.0.8)@@ -423,6 +457,7 @@ DEPENDENCIESbyebugcertifiedcppjieba_rb+ dangerdiscourse_image_optimemail_reply_trimmer (~> 0.1)ember-handlebars-template (= 0.7.5)