DEV: implementing danger for travis

This commit is contained in:
Joffrey JAFFEUX 2018-07-24 10:12:15 -04:00 committed by GitHub
parent 8ca25f5aed
commit b4a2f3fe2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 66 additions and 1 deletions

View File

@ -72,7 +72,7 @@ script:
- | - |
bash -c " bash -c "
if [ '$RUN_LINT' == '1' ]; then if [ '$RUN_LINT' == '1' ]; then
bundle exec rubocop --parallel && \ bundle exec danger && \
eslint --ext .es6 app/assets/javascripts && \ eslint --ext .es6 app/assets/javascripts && \
eslint --ext .es6 test/javascripts && \ eslint --ext .es6 test/javascripts && \
eslint --ext .es6 plugins/**/assets/javascripts && \ eslint --ext .es6 plugins/**/assets/javascripts && \

29
Dangerfile Normal file
View File

@ -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 cant 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")}
})
end

View File

@ -108,6 +108,7 @@ group :test do
gem 'webmock', require: false gem 'webmock', require: false
gem 'fakeweb', '~> 1.3.0', require: false gem 'fakeweb', '~> 1.3.0', require: false
gem 'minitest', require: false gem 'minitest', require: false
gem 'danger'
end end
group :test, :development do group :test, :development do

View File

@ -76,13 +76,33 @@ GEM
byebug (10.0.2) byebug (10.0.2)
certified (1.0.0) certified (1.0.0)
chunky_png (1.3.10) chunky_png (1.3.10)
claide (1.0.2)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
coderay (1.1.2) coderay (1.1.2)
colored2 (3.1.2)
concurrent-ruby (1.0.5) concurrent-ruby (1.0.5)
connection_pool (2.2.2) connection_pool (2.2.2)
cork (0.3.0)
colored2 (~> 3.1)
cppjieba_rb (0.3.0) cppjieba_rb (0.3.0)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
crass (1.0.4) 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) debug_inspector (0.0.3)
diff-lcs (1.3) diff-lcs (1.3)
discourse_image_optim (0.26.2) discourse_image_optim (0.26.2)
@ -113,6 +133,8 @@ GEM
fakeweb (1.3.0) fakeweb (1.3.0)
faraday (0.12.2) faraday (0.12.2)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fast_blank (1.0.0) fast_blank (1.0.0)
fast_xor (1.1.3) fast_xor (1.1.3)
rake rake
@ -125,6 +147,7 @@ GEM
thor (~> 0.19.1) thor (~> 0.19.1)
fspath (3.1.0) fspath (3.1.0)
gc_tracer (1.5.1) gc_tracer (1.5.1)
git (1.4.0)
globalid (0.4.1) globalid (0.4.1)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
guess_html_encoding (0.0.11) guess_html_encoding (0.0.11)
@ -147,6 +170,7 @@ GEM
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jwt (1.5.6) jwt (1.5.6)
kgio (2.11.2) kgio (2.11.2)
kramdown (1.17.0)
libv8 (6.7.288.46.1) libv8 (6.7.288.46.1)
listen (3.1.5) listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4) rb-fsevent (~> 0.9, >= 0.9.4)
@ -189,6 +213,8 @@ GEM
multi_xml (0.6.0) multi_xml (0.6.0)
multipart-post (2.0.0) multipart-post (2.0.0)
mustache (1.0.5) mustache (1.0.5)
nap (1.1.0)
no_proxy_fix (0.1.2)
nokogiri (1.8.3) nokogiri (1.8.3)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.3.0)
nokogumbo (1.5.0) nokogumbo (1.5.0)
@ -200,6 +226,8 @@ GEM
multi_json (~> 1.3) multi_json (~> 1.3)
multi_xml (~> 0.5) multi_xml (~> 0.5)
rack (>= 1.2, < 3) rack (>= 1.2, < 3)
octokit (4.9.0)
sawyer (~> 0.8.0, >= 0.5.3)
oj (3.6.2) oj (3.6.2)
omniauth (1.8.1) omniauth (1.8.1)
hashie (>= 3.4.6, < 3.6.0) hashie (>= 3.4.6, < 3.6.0)
@ -235,6 +263,7 @@ GEM
mustache mustache
nokogiri (~> 1.7) nokogiri (~> 1.7)
sanitize sanitize
open4 (1.3.4)
openid-redis-store (0.0.2) openid-redis-store (0.0.2)
redis redis
ruby-openid ruby-openid
@ -354,6 +383,9 @@ GEM
bundler bundler
ffi (~> 1.9.6) ffi (~> 1.9.6)
sass (>= 3.3.0) sass (>= 3.3.0)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
seed-fu (2.3.9) seed-fu (2.3.9)
activerecord (>= 3.1) activerecord (>= 3.1)
activesupport (>= 3.1) activesupport (>= 3.1)
@ -378,6 +410,8 @@ GEM
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sshkey (1.9.0) sshkey (1.9.0)
stackprof (0.2.11) stackprof (0.2.11)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.19.4) thor (0.19.4)
thread_safe (0.3.6) thread_safe (0.3.6)
tilt (2.0.8) tilt (2.0.8)
@ -423,6 +457,7 @@ DEPENDENCIES
byebug byebug
certified certified
cppjieba_rb cppjieba_rb
danger
discourse_image_optim discourse_image_optim
email_reply_trimmer (~> 0.1) email_reply_trimmer (~> 0.1)
ember-handlebars-template (= 0.7.5) ember-handlebars-template (= 0.7.5)