Fix rubucop offenses

This commit is contained in:
Douglas Barbosa Alexandre 2016-12-16 17:11:04 -02:00
parent 20e472d946
commit dbe2ac8ccc
2 changed files with 25 additions and 26 deletions

View File

@ -60,8 +60,6 @@ module Gitlab
create_labels
gitlab_issue = nil
client.issues(repo).each do |issue|
begin
description = ''
@ -87,31 +85,33 @@ module Gitlab
gitlab_issue.labels << @labels[label_name]
if gitlab_issue.persisted?
client.issue_comments(repo, issue.iid).each do |comment|
# The note can be blank for issue service messages like "Changed title: ..."
# 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.
# To prevent our importer from just crashing or from creating useless empty comments
# we do this check.
next unless comment.note.present?
import_issue_comments(issue, gitlab_issue) if gitlab_issue.persisted?
end
end
note = ''
note += @formatter.author_line(comment.author) unless find_user_id(comment.author)
note += comment.note
def import_issue_comments(issue, gitlab_issue)
client.issue_comments(repo, issue.iid).each do |comment|
# The note can be blank for issue service messages like "Changed title: ..."
# 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.
# To prevent our importer from just crashing or from creating useless empty comments
# we do this check.
next unless comment.note.present?
begin
gitlab_issue.notes.create!(
project: project,
note: note,
author_id: gitlab_user_id(project, comment.author),
created_at: comment.created_at,
updated_at: comment.updated_at
)
rescue StandardError => e
errors << { type: :issue_comment, iid: issue.iid, errors: e.message }
end
end
note = ''
note += @formatter.author_line(comment.author) unless find_user_id(comment.author)
note += comment.note
begin
gitlab_issue.notes.create!(
project: project,
note: note,
author_id: gitlab_user_id(project, comment.author),
created_at: comment.created_at,
updated_at: comment.updated_at
)
rescue StandardError => e
errors << { type: :issue_comment, iid: issue.iid, errors: e.message }
end
end
end

View File

@ -14,7 +14,6 @@ describe Bitbucket::Representation::Issue do
it { expect(described_class.new({}).milestone).to be_nil }
end
describe '#author' do
it { expect(described_class.new({ 'reporter' => { 'username' => 'Ben' } }).author).to eq('Ben') }
it { expect(described_class.new({}).author).to be_nil }