This is an automated email from the ASF dual-hosted git repository.
zhangliang2022 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 1be7988fc refactor: improve slice size check for gitlab (#4054)
1be7988fc is described below
commit 1be7988fcc483f5ca1f7d1ba96b6ba53490561d7
Author: mindlesscloud <[email protected]>
AuthorDate: Wed Dec 28 21:55:36 2022 +0800
refactor: improve slice size check for gitlab (#4054)
---
plugins/gitlab/tasks/issue_extractor.go | 6 +++---
plugins/gitlab/tasks/mr_extractor.go | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugins/gitlab/tasks/issue_extractor.go
b/plugins/gitlab/tasks/issue_extractor.go
index 633e3770e..a839536ca 100644
--- a/plugins/gitlab/tasks/issue_extractor.go
+++ b/plugins/gitlab/tasks/issue_extractor.go
@@ -206,21 +206,21 @@ func ExtractApiIssues(taskCtx core.SubTaskContext)
errors.Error {
})
if issueSeverityRegex != nil {
groups :=
issueSeverityRegex.FindStringSubmatch(label)
- if len(groups) > 0 {
+ if len(groups) > 1 {
gitlabIssue.Severity = groups[1]
}
}
if issueComponentRegex != nil {
groups :=
issueComponentRegex.FindStringSubmatch(label)
- if len(groups) > 0 {
+ if len(groups) > 1 {
gitlabIssue.Component =
groups[1]
}
}
if issuePriorityRegex != nil {
groups :=
issuePriorityRegex.FindStringSubmatch(label)
- if len(groups) > 0 {
+ if len(groups) > 1 {
gitlabIssue.Priority = groups[1]
}
}
diff --git a/plugins/gitlab/tasks/mr_extractor.go
b/plugins/gitlab/tasks/mr_extractor.go
index d04ab0bf0..b33a185da 100644
--- a/plugins/gitlab/tasks/mr_extractor.go
+++ b/plugins/gitlab/tasks/mr_extractor.go
@@ -119,7 +119,7 @@ func ExtractApiMergeRequests(taskCtx core.SubTaskContext)
errors.Error {
// if pr.Type has not been set and prType is
set in .env, process the below
if labelTypeRegex != nil {
groups :=
labelTypeRegex.FindStringSubmatch(label)
- if len(groups) > 0 {
+ if len(groups) > 1 {
gitlabMergeRequest.Type =
groups[1]
}
}
@@ -127,7 +127,7 @@ func ExtractApiMergeRequests(taskCtx core.SubTaskContext)
errors.Error {
// if pr.Component has not been set and
prComponent is set in .env, process
if labelComponentRegex != nil {
groups :=
labelComponentRegex.FindStringSubmatch(label)
- if len(groups) > 0 {
+ if len(groups) > 1 {
gitlabMergeRequest.Component =
groups[1]
}
}