Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-16 22:11:04 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-16 22:11:54 +0300
commitdbe2ac8ccc07f53669214eb954489a6cb233d4e9 (patch)
tree20e15901fb6ee505e19ee25ea4fe57045ac3bc92 /lib/gitlab/bitbucket_import
parent20e472d946d7cc4a2b9dd91264458b1c4ceb5ab6 (diff)
Fix rubucop offenses
Diffstat (limited to 'lib/gitlab/bitbucket_import')
-rw-r--r--lib/gitlab/bitbucket_import/importer.rb54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/gitlab/bitbucket_import/importer.rb b/lib/gitlab/bitbucket_import/importer.rb
index f3760640655..d5287c69e6e 100644
--- a/lib/gitlab/bitbucket_import/importer.rb
+++ b/lib/gitlab/bitbucket_import/importer.rb
@@ -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?
-
- 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
+ import_issue_comments(issue, gitlab_issue) if gitlab_issue.persisted?
+ end
+ end
+
+ 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?
+
+ 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