Skip to content

Commit 8ad6c93

Browse files
fix(gitlab): add strconv import and license header; fix else-if syntax
1 parent 60922bf commit 8ad6c93

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

backend/plugins/gitlab/models/migrationscripts/add_additions_deletions_to_mr.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
118
package migrationscripts
219

320
import (

backend/plugins/gitlab/tasks/mr_extractor.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package tasks
1919

2020
import (
2121
"regexp"
22+
"strconv"
2223
"strings"
2324

2425
"github.com/apache/incubator-devlake/core/dal"
@@ -65,7 +66,7 @@ type MergeRequestRes struct {
6566
Assignees []Assignee
6667
FirstCommentTime common.Iso8601Time
6768
Labels []string `json:"labels"`
68-
DiffStats *struct {
69+
DiffStats *struct {
6970
Additions int `json:"additions"`
7071
Deletions int `json:"deletions"`
7172
} `json:"diff_stats"`
@@ -256,8 +257,7 @@ func convertMergeRequest(mr *MergeRequestRes) (*models.GitlabMergeRequest, error
256257
if mr.DiffStats != nil && (mr.DiffStats.Additions > 0 || mr.DiffStats.Deletions > 0) {
257258
gitlabMergeRequest.Additions = mr.DiffStats.Additions
258259
gitlabMergeRequest.Deletions = mr.DiffStats.Deletions
259-
}
260-
else if mr.ChangesCount != "" && mr.ChangesCount != "0" {
260+
} else if mr.ChangesCount != "" && mr.ChangesCount != "0" {
261261
count, err := strconv.Atoi(mr.ChangesCount)
262262
if err == nil {
263263
// changes_count is cumulative (bug source), but better than zero

0 commit comments

Comments
 (0)