mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
improves danger formatting (#6162)
This commit is contained in:
parent
7058205f70
commit
e8b9bd7d9b
1 changed files with 5 additions and 6 deletions
11
Dangerfile
11
Dangerfile
|
@ -7,7 +7,6 @@ end
|
||||||
|
|
||||||
to_lint = git.modified_files + git.added_files
|
to_lint = git.modified_files + git.added_files
|
||||||
files_to_lint = Shellwords.join(to_lint)
|
files_to_lint = Shellwords.join(to_lint)
|
||||||
|
|
||||||
rubocop_output = `bundle exec rubocop -f json --parallel #{files_to_lint}`
|
rubocop_output = `bundle exec rubocop -f json --parallel #{files_to_lint}`
|
||||||
if !rubocop_output.empty?
|
if !rubocop_output.empty?
|
||||||
offenses = JSON.parse(rubocop_output)['files']
|
offenses = JSON.parse(rubocop_output)['files']
|
||||||
|
@ -23,16 +22,16 @@ if !rubocop_output.empty?
|
||||||
|
|
||||||
if !offenses.empty?
|
if !offenses.empty?
|
||||||
fail(%{
|
fail(%{
|
||||||
This PR has multiple rubocop offenses:\n
|
This PR has multiple rubocop offenses. We recommend configuring prettier linting in your editor:\n
|
||||||
#{offenses.map { |o| format_offense(o) }.join('\n') }
|
#{offenses.map { |o| format_offense(o) }.join('\n') }
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
prettier_offenses = `prettier --list-different #{files_to_lint}`.split('\n')
|
prettier_offenses = `prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6" "plugins/**/*.scss" "plugins/**/*.es6"`.split('\n')
|
||||||
if !prettier_offenses.empty?
|
if !prettier_offenses.empty?
|
||||||
fail(%{
|
fail(%{
|
||||||
This PR has multiple prettier offenses (we recommend configuring prettier linting in your editor):\n
|
This PR has multiple prettier offenses (prettier.io). We recommend configuring prettier linting in your editor:\n
|
||||||
#{prettier_offenses.join("\n")}
|
#{prettier_offenses.join("\n")}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue