bridge/gitlab: global code and comment updates

Amine and Michael Muré created

Co-Authored-By: Michael Muré <batolettre@gmail.com>

Change summary

bridge/gitlab/config.go   | 8 ++++----
bridge/gitlab/iterator.go | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)

Detailed changes

bridge/gitlab/config.go 🔗

@@ -62,13 +62,13 @@ func (*Gitlab) Configure(repo repository.RepoCommon, params core.BridgeParams) (
 	}
 
 	var ok bool
-	// validate project url and get it ID
+	// validate project url and get its ID
 	ok, id, err := validateProjectURL(url, token)
 	if err != nil {
 		return nil, errors.Wrap(err, "project validation")
 	}
 	if !ok {
-		return nil, fmt.Errorf("invalid project id or wrong token scope")
+		return nil, fmt.Errorf("invalid project id or incorrect token scope")
 	}
 
 	conf[keyProjectID] = strconv.Itoa(id)
@@ -121,7 +121,7 @@ func promptToken() (string, error) {
 			return token, nil
 		}
 
-		fmt.Println("token is invalid")
+		fmt.Println("token format is invalid")
 	}
 }
 
@@ -147,7 +147,7 @@ func promptURL(remotes map[string]string) (string, error) {
 			line = strings.TrimRight(line, "\n")
 
 			index, err := strconv.Atoi(line)
-			if err != nil || (index < 0 && index >= len(validRemotes)) {
+			if err != nil || (index < 0 && index > len(validRemotes)) {
 				fmt.Println("invalid input")
 				continue
 			}

bridge/gitlab/iterator.go 🔗

@@ -124,7 +124,7 @@ func (i *iterator) NextIssue() bool {
 	}
 
 	// move cursor index
-	if i.issue.index < min(i.capacity, len(i.issue.cache))-1 {
+	if i.issue.index < len(i.issue.cache)-1 {
 		i.issue.index++
 		return true
 	}
@@ -180,7 +180,7 @@ func (i *iterator) NextNote() bool {
 	}
 
 	// move cursor index
-	if i.note.index < min(i.capacity, len(i.note.cache))-1 {
+	if i.note.index < len(i.note.cache)-1 {
 		i.note.index++
 		return true
 	}
@@ -232,7 +232,7 @@ func (i *iterator) NextLabelEvent() bool {
 	}
 
 	// move cursor index
-	if i.labelEvent.index < min(i.capacity, len(i.labelEvent.cache))-1 {
+	if i.labelEvent.index < len(i.labelEvent.cache)-1 {
 		i.labelEvent.index++
 		return true
 	}