2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-04 08:47:37 +08:00

removes rubocop from dangerfile for now (#6168)

This will be re-enabled once I can reproduce and fix errors using travis local docker build.
This commit is contained in:
Joffrey JAFFEUX 2018-07-24 18:10:02 -04:00 committed by GitHub
parent 29e612e86a
commit 9516d3de4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 27 deletions

View file

@ -1,33 +1,7 @@
require 'json'
require 'shellwords'
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 PRs.")
end
to_lint = git.modified_files + git.added_files
files_to_lint = Shellwords.join(to_lint)
rubocop_output = `bundle exec rubocop -f json --parallel #{files_to_lint}`
if !rubocop_output.empty?
offenses = JSON.parse(rubocop_output)['files']
.select { |f| f['offenses'].any? }
def format_offense(offense)
output = "file: #{offense['path']}\n"
offense['offenses'].each do |o|
output << "#{o['message']} (line:#{o['location']['start_line']}, col:#{o['location']['start_column']})\n"
end
output << "\n"
end
if !offenses.empty?
fail(%{
This PR has multiple rubocop offenses. We recommend configuring prettier linting in your editor:\n
#{offenses.map { |o| format_offense(o) }.join('\n') }
})
end
end
prettier_offenses = `prettier --list-different "app/assets/stylesheets/**/*.scss" "app/assets/javascripts/**/*.es6" "test/javascripts/**/*.es6"`.split('\n')
if !prettier_offenses.empty?
fail(%{