Commit 72a04002 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '28202_decrease_abc_threshold_step3' into 'master'

Decrease ABC threshold to 55.25

See merge request !13904
parents 6d6223ec d807d381
...@@ -624,7 +624,7 @@ Style/PredicateName: ...@@ -624,7 +624,7 @@ Style/PredicateName:
# branches, and conditions. # branches, and conditions.
Metrics/AbcSize: Metrics/AbcSize:
Enabled: true Enabled: true
Max: 56.96 Max: 55.25
# This cop checks if the length of a block exceeds some maximum value. # This cop checks if the length of a block exceeds some maximum value.
Metrics/BlockLength: Metrics/BlockLength:
......
---
title: Decrease ABC threshold to 55.25
merge_request: 13904
author: Maxim Rydkin
type: other
...@@ -226,7 +226,13 @@ module Github ...@@ -226,7 +226,13 @@ module Github
while url while url
response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc) response = Github::Client.new(options).get(url, state: :all, sort: :created, direction: :asc)
response.body.each do |raw| response.body.each { |raw| populate_issue(raw) }
url = response.rels[:next]
end
end
def populate_issue(raw)
representation = Github::Representation::Issue.new(raw, options) representation = Github::Representation::Issue.new(raw, options)
begin begin
...@@ -235,12 +241,12 @@ module Github ...@@ -235,12 +241,12 @@ module Github
# for both features, like manipulating assignees, labels # for both features, like manipulating assignees, labels
# and milestones, are provided within the Issues API. # and milestones, are provided within the Issues API.
if representation.pull_request? if representation.pull_request?
next unless representation.has_labels? return unless representation.has_labels?
merge_request = MergeRequest.find_by!(target_project_id: project.id, iid: representation.iid) merge_request = MergeRequest.find_by!(target_project_id: project.id, iid: representation.iid)
merge_request.update_attribute(:label_ids, label_ids(representation.labels)) merge_request.update_attribute(:label_ids, label_ids(representation.labels))
else else
next if Issue.where(iid: representation.iid, project_id: project.id).exists? return if Issue.where(iid: representation.iid, project_id: project.id).exists?
author_id = user_id(representation.author, project.creator_id) author_id = user_id(representation.author, project.creator_id)
issue = Issue.new issue = Issue.new
...@@ -268,10 +274,6 @@ module Github ...@@ -268,10 +274,6 @@ module Github
end end
end end
url = response.rels[:next]
end
end
def fetch_comments(noteable, type, url, klass = Note) def fetch_comments(noteable, type, url, klass = Note)
while url while url
comments = Github::Client.new(options).get(url) comments = Github::Client.new(options).get(url)
......
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