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:
parent
8ca25f5aed
commit
b4a2f3fe2f
4 changed files with 66 additions and 1 deletions
29
Dangerfile
Normal file
29
Dangerfile
Normal 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 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")}
|
||||
})
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue