Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d807d381
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d807d381
编写于
8月 31, 2017
作者:
M
Maxim Rydkin
提交者:
Grzegorz Bizon
8月 31, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Decrease ABC threshold to 55.25
上级
6d6223ec
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
41 deletion
+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
未找到文件。
.rubocop.yml
浏览文件 @
d807d381
...
...
@@ -624,7 +624,7 @@ Style/PredicateName:
# branches, and conditions.
Metrics/AbcSize
:
Enabled
:
true
Max
:
5
6.96
Max
:
5
5.25
# This cop checks if the length of a block exceeds some maximum value.
Metrics/BlockLength
:
...
...
changelogs/unreleased/28202_decrease_abc_threshold_step3.yml
0 → 100644
浏览文件 @
d807d381
---
title
:
Decrease ABC threshold to
55.25
merge_request
:
13904
author
:
Maxim Rydkin
type
:
other
lib/github/import.rb
浏览文件 @
d807d381
...
...
@@ -226,49 +226,51 @@ module Github
while
url
response
=
Github
::
Client
.
new
(
options
).
get
(
url
,
state: :all
,
sort: :created
,
direction: :asc
)
response
.
body
.
each
do
|
raw
|
representation
=
Github
::
Representation
::
Issue
.
new
(
raw
,
options
)
response
.
body
.
each
{
|
raw
|
populate_issue
(
raw
)
}
begin
# Every pull request is an issue, but not every issue
# is a pull request. For this reason, "shared" actions
# for both features, like manipulating assignees, labels
# and milestones, are provided within the Issues API.
if
representation
.
pull_request?
next
unless
representation
.
has_labels?
merge_request
=
MergeRequest
.
find_by!
(
target_project_id:
project
.
id
,
iid:
representation
.
iid
)
merge_request
.
update_attribute
(
:label_ids
,
label_ids
(
representation
.
labels
))
else
next
if
Issue
.
where
(
iid:
representation
.
iid
,
project_id:
project
.
id
).
exists?
author_id
=
user_id
(
representation
.
author
,
project
.
creator_id
)
issue
=
Issue
.
new
issue
.
iid
=
representation
.
iid
issue
.
project_id
=
project
.
id
issue
.
title
=
representation
.
title
issue
.
description
=
format_description
(
representation
.
description
,
representation
.
author
)
issue
.
state
=
representation
.
state
issue
.
label_ids
=
label_ids
(
representation
.
labels
)
issue
.
milestone_id
=
milestone_id
(
representation
.
milestone
)
issue
.
author_id
=
author_id
issue
.
assignee_ids
=
[
user_id
(
representation
.
assignee
)]
issue
.
created_at
=
representation
.
created_at
issue
.
updated_at
=
representation
.
updated_at
issue
.
save!
(
validate:
false
)
# Fetch comments
if
representation
.
has_comments?
comments_url
=
"/repos/
#{
repo
}
/issues/
#{
issue
.
iid
}
/comments"
fetch_comments
(
issue
,
:comment
,
comments_url
)
end
end
rescue
=>
e
error
(
:issue
,
representation
.
url
,
e
.
message
)
url
=
response
.
rels
[
:next
]
end
end
def
populate_issue
(
raw
)
representation
=
Github
::
Representation
::
Issue
.
new
(
raw
,
options
)
begin
# Every pull request is an issue, but not every issue
# is a pull request. For this reason, "shared" actions
# for both features, like manipulating assignees, labels
# and milestones, are provided within the Issues API.
if
representation
.
pull_request?
return
unless
representation
.
has_labels?
merge_request
=
MergeRequest
.
find_by!
(
target_project_id:
project
.
id
,
iid:
representation
.
iid
)
merge_request
.
update_attribute
(
:label_ids
,
label_ids
(
representation
.
labels
))
else
return
if
Issue
.
where
(
iid:
representation
.
iid
,
project_id:
project
.
id
).
exists?
author_id
=
user_id
(
representation
.
author
,
project
.
creator_id
)
issue
=
Issue
.
new
issue
.
iid
=
representation
.
iid
issue
.
project_id
=
project
.
id
issue
.
title
=
representation
.
title
issue
.
description
=
format_description
(
representation
.
description
,
representation
.
author
)
issue
.
state
=
representation
.
state
issue
.
label_ids
=
label_ids
(
representation
.
labels
)
issue
.
milestone_id
=
milestone_id
(
representation
.
milestone
)
issue
.
author_id
=
author_id
issue
.
assignee_ids
=
[
user_id
(
representation
.
assignee
)]
issue
.
created_at
=
representation
.
created_at
issue
.
updated_at
=
representation
.
updated_at
issue
.
save!
(
validate:
false
)
# Fetch comments
if
representation
.
has_comments?
comments_url
=
"/repos/
#{
repo
}
/issues/
#{
issue
.
iid
}
/comments"
fetch_comments
(
issue
,
:comment
,
comments_url
)
end
end
url
=
response
.
rels
[
:next
]
rescue
=>
e
error
(
:issue
,
representation
.
url
,
e
.
message
)
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录