Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
d807d381
Commit
d807d381
authored
Aug 31, 2017
by
Maxim Rydkin
Committed by
Grzegorz Bizon
Aug 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Decrease ABC threshold to 55.25
parent
6d6223ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
41 deletions
+48
-41
.rubocop.yml
.rubocop.yml
+1
-1
changelogs/unreleased/28202_decrease_abc_threshold_step3.yml
changelogs/unreleased/28202_decrease_abc_threshold_step3.yml
+5
-0
lib/github/import.rb
lib/github/import.rb
+42
-40
No files found.
.rubocop.yml
View file @
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
:
5
6.96
Max
:
5
5.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
:
...
...
changelogs/unreleased/28202_decrease_abc_threshold_step3.yml
0 → 100644
View file @
d807d381
---
title
:
Decrease ABC threshold to
55.25
merge_request
:
13904
author
:
Maxim Rydkin
type
:
other
lib/github/import.rb
View file @
d807d381
...
@@ -226,49 +226,51 @@ module Github
...
@@ -226,49 +226,51 @@ 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
)
}
representation
=
Github
::
Representation
::
Issue
.
new
(
raw
,
options
)
begin
url
=
response
.
rels
[
:next
]
# Every pull request is an issue, but not every issue
end
# is a pull request. For this reason, "shared" actions
end
# for both features, like manipulating assignees, labels
# and milestones, are provided within the Issues API.
def
populate_issue
(
raw
)
if
representation
.
pull_request?
representation
=
Github
::
Representation
::
Issue
.
new
(
raw
,
options
)
next
unless
representation
.
has_labels?
begin
merge_request
=
MergeRequest
.
find_by!
(
target_project_id:
project
.
id
,
iid:
representation
.
iid
)
# Every pull request is an issue, but not every issue
merge_request
.
update_attribute
(
:label_ids
,
label_ids
(
representation
.
labels
))
# is a pull request. For this reason, "shared" actions
else
# for both features, like manipulating assignees, labels
next
if
Issue
.
where
(
iid:
representation
.
iid
,
project_id:
project
.
id
).
exists?
# and milestones, are provided within the Issues API.
if
representation
.
pull_request?
author_id
=
user_id
(
representation
.
author
,
project
.
creator_id
)
return
unless
representation
.
has_labels?
issue
=
Issue
.
new
issue
.
iid
=
representation
.
iid
merge_request
=
MergeRequest
.
find_by!
(
target_project_id:
project
.
id
,
iid:
representation
.
iid
)
issue
.
project_id
=
project
.
id
merge_request
.
update_attribute
(
:label_ids
,
label_ids
(
representation
.
labels
))
issue
.
title
=
representation
.
title
else
issue
.
description
=
format_description
(
representation
.
description
,
representation
.
author
)
return
if
Issue
.
where
(
iid:
representation
.
iid
,
project_id:
project
.
id
).
exists?
issue
.
state
=
representation
.
state
issue
.
label_ids
=
label_ids
(
representation
.
labels
)
author_id
=
user_id
(
representation
.
author
,
project
.
creator_id
)
issue
.
milestone_id
=
milestone_id
(
representation
.
milestone
)
issue
=
Issue
.
new
issue
.
author_id
=
author_id
issue
.
iid
=
representation
.
iid
issue
.
assignee_ids
=
[
user_id
(
representation
.
assignee
)]
issue
.
project_id
=
project
.
id
issue
.
created_at
=
representation
.
created_at
issue
.
title
=
representation
.
title
issue
.
updated_at
=
representation
.
updated_at
issue
.
description
=
format_description
(
representation
.
description
,
representation
.
author
)
issue
.
save!
(
validate:
false
)
issue
.
state
=
representation
.
state
issue
.
label_ids
=
label_ids
(
representation
.
labels
)
# Fetch comments
issue
.
milestone_id
=
milestone_id
(
representation
.
milestone
)
if
representation
.
has_comments?
issue
.
author_id
=
author_id
comments_url
=
"/repos/
#{
repo
}
/issues/
#{
issue
.
iid
}
/comments"
issue
.
assignee_ids
=
[
user_id
(
representation
.
assignee
)]
fetch_comments
(
issue
,
:comment
,
comments_url
)
issue
.
created_at
=
representation
.
created_at
end
issue
.
updated_at
=
representation
.
updated_at
end
issue
.
save!
(
validate:
false
)
rescue
=>
e
error
(
:issue
,
representation
.
url
,
e
.
message
)
# Fetch comments
if
representation
.
has_comments?
comments_url
=
"/repos/
#{
repo
}
/issues/
#{
issue
.
iid
}
/comments"
fetch_comments
(
issue
,
:comment
,
comments_url
)
end
end
end
end
rescue
=>
e
url
=
response
.
rels
[
:next
]
error
(
:issue
,
representation
.
url
,
e
.
message
)
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment