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 "
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 && \

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 'fakeweb', '~> 1.3.0', require: false
gem 'minitest', require: false
gem 'danger'
end
group :test, :development do

View File

@ -76,13 +76,33 @@ GEM
byebug (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 @@ GEM
fakeweb (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 @@ GEM
thor (~> 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 @@ GEM
thor (>= 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 @@ GEM
multi_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 @@ GEM
multi_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 @@ GEM
mustache
nokogiri (~> 1.7)
sanitize
open4 (1.3.4)
openid-redis-store (0.0.2)
redis
ruby-openid
@ -354,6 +383,9 @@ GEM
bundler
ffi (~> 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 @@ GEM
sprockets (>= 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 @@ DEPENDENCIES
byebug
certified
cppjieba_rb
danger
discourse_image_optim
email_reply_trimmer (~> 0.1)
ember-handlebars-template (= 0.7.5)