BigW Consortium Gitlab

Fix rubucop offenses

parent 20e472d9
...@@ -60,8 +60,6 @@ module Gitlab ...@@ -60,8 +60,6 @@ module Gitlab
create_labels create_labels
gitlab_issue = nil
client.issues(repo).each do |issue| client.issues(repo).each do |issue|
begin begin
description = '' description = ''
...@@ -87,31 +85,33 @@ module Gitlab ...@@ -87,31 +85,33 @@ module Gitlab
gitlab_issue.labels << @labels[label_name] gitlab_issue.labels << @labels[label_name]
if gitlab_issue.persisted? import_issue_comments(issue, gitlab_issue) if gitlab_issue.persisted?
client.issue_comments(repo, issue.iid).each do |comment| end
# The note can be blank for issue service messages like "Changed title: ..." end
# We would like to import those comments as well but there is no any
# specific parameter that would allow to process them, it's just an empty comment. def import_issue_comments(issue, gitlab_issue)
# To prevent our importer from just crashing or from creating useless empty comments client.issue_comments(repo, issue.iid).each do |comment|
# we do this check. # The note can be blank for issue service messages like "Changed title: ..."
next unless comment.note.present? # We would like to import those comments as well but there is no any
# specific parameter that would allow to process them, it's just an empty comment.
note = '' # To prevent our importer from just crashing or from creating useless empty comments
note += @formatter.author_line(comment.author) unless find_user_id(comment.author) # we do this check.
note += comment.note next unless comment.note.present?
begin note = ''
gitlab_issue.notes.create!( note += @formatter.author_line(comment.author) unless find_user_id(comment.author)
project: project, note += comment.note
note: note,
author_id: gitlab_user_id(project, comment.author), begin
created_at: comment.created_at, gitlab_issue.notes.create!(
updated_at: comment.updated_at project: project,
) note: note,
rescue StandardError => e author_id: gitlab_user_id(project, comment.author),
errors << { type: :issue_comment, iid: issue.iid, errors: e.message } created_at: comment.created_at,
end updated_at: comment.updated_at
end )
rescue StandardError => e
errors << { type: :issue_comment, iid: issue.iid, errors: e.message }
end end
end end
end end
......
...@@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do ...@@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do
it { expect(described_class.new({}).milestone).to be_nil } it { expect(described_class.new({}).milestone).to be_nil }
end end
describe '#author' do describe '#author' do
it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' } }).author).to eq('Ben') } it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' } }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to be_nil } it { expect(described_class.new({}).author).to be_nil }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment