2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-03 08:39:21 +08:00

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

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