1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-05 18:17:19 +00:00

Enable addtional linters (#34085)

enable mirror, usestdlibbars and perfsprint 
part of: https://github.com/go-gitea/gitea/issues/34083

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
TheFox0x7
2025-04-01 12:14:01 +02:00
committed by GitHub
parent 56e42be36d
commit ee3c82f874
294 changed files with 848 additions and 805 deletions

View File

@ -6,6 +6,7 @@ package gitdiff
import (
"bufio"
"context"
"errors"
"fmt"
"io"
"strconv"
@ -71,7 +72,7 @@ func runGitDiffTree(ctx context.Context, gitRepo *git.Repository, useMergeBase b
func validateGitDiffTreeArguments(gitRepo *git.Repository, useMergeBase bool, baseSha, headSha string) (shouldUseMergeBase bool, resolvedBaseSha, resolvedHeadSha string, err error) {
// if the head is empty its an error
if headSha == "" {
return false, "", "", fmt.Errorf("headSha is empty")
return false, "", "", errors.New("headSha is empty")
}
// if the head commit doesn't exist its and error
@ -207,7 +208,7 @@ func parseGitDiffTreeLine(line string) (*DiffTreeRecord, error) {
func statusFromLetter(rawStatus string) (status string, score uint8, err error) {
if len(rawStatus) < 1 {
return "", 0, fmt.Errorf("empty status letter")
return "", 0, errors.New("empty status letter")
}
switch rawStatus[0] {
case 'A':
@ -235,7 +236,7 @@ func statusFromLetter(rawStatus string) (status string, score uint8, err error)
func tryParseStatusScore(rawStatus string) (uint8, error) {
if len(rawStatus) < 2 {
return 0, fmt.Errorf("status score missing")
return 0, errors.New("status score missing")
}
score, err := strconv.ParseUint(rawStatus[1:], 10, 8)