don't include plugin dir in gergich output sent to jenkins

it's useful locally, but causes mismatches for Jenkins

Change-Id: I2606b1a0d15bafc5f6f9ad90735d4207dcc8bddf
Reviewed-on: https://gerrit.instructure.com/70502
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2016-01-18 13:10:22 -07:00
parent 29e65e1723
commit 1b7ce8aacb
2 changed files with 7 additions and 5 deletions

View File

@ -3,10 +3,10 @@ require_relative './user_config'
module RuboCop::Canvas
class Comments
def self.build(raw_diff_tree, cop_output, git_dir: nil, boyscout_mode: false)
def self.build(raw_diff_tree, cop_output, git_dir: nil, boyscout_mode: false, include_git_dir_in_output: true)
diff = DiffParser.new(raw_diff_tree)
comments = self.new(diff, git_dir)
comments.on_output(cop_output, boyscout_mode)
comments.on_output(cop_output, boyscout_mode, include_git_dir_in_output)
end
attr_reader :diff
@ -15,14 +15,14 @@ module RuboCop::Canvas
@git_dir = git_dir
end
def on_output(cop_output, boyscout_mode = false)
def on_output(cop_output, boyscout_mode = false, include_git_dir_in_output = true)
comments = []
cop_output['files'].each do |file|
path = file['path']
path = path[@git_dir.length..-1] if @git_dir
file['offenses'].each do |offense|
if diff.relevant?(path, line_number(offense), boyscout_mode || severe?(offense))
comments << transform_to_gergich_comment(file['path'], offense)
comments << transform_to_gergich_comment(include_git_dir_in_output ? file['path'] : path, offense)
end
end
end

View File

@ -44,7 +44,9 @@ if ENV['GERRIT_PATCHSET_REVISION']
results_json = get_offenses_json(file_sieve, env_sha)
unless results_json.empty?
diff = git_diff(file_sieve.git, env_sha)
comments = RuboCop::Canvas::Comments.build(diff, results_json, git_dir: git_dir)
comments = RuboCop::Canvas::Comments.build(diff, results_json,
git_dir: git_dir,
include_git_dir_in_output: false)
`gergich comment #{Shellwords.escape(comments.to_json)}`
end
else