enable nolintlint linter

This commit is contained in:
Matthieu MOREL 2021-12-20 23:05:05 +01:00 committed by GitHub
parent 13628660c1
commit 4634ce10b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 8 deletions

View File

@ -13,6 +13,7 @@ linters:
- megacheck - megacheck
- misspell - misspell
- nakedret - nakedret
- nolintlint
- revive - revive
- unconvert - unconvert
- unparam - unparam

View File

@ -135,7 +135,7 @@ func opTokenWithPrefs(op *operationType, assignOpType *operationType, preference
func extractNumberParamter(value string) (int, error) { func extractNumberParamter(value string) (int, error) {
parameterParser := regexp.MustCompile(`.*\(([0-9]+)\)`) parameterParser := regexp.MustCompile(`.*\(([0-9]+)\)`)
matches := parameterParser.FindStringSubmatch(value) matches := parameterParser.FindStringSubmatch(value)
var indent, errParsingInt = strconv.ParseInt(matches[1], 10, 32) // nolint var indent, errParsingInt = strconv.ParseInt(matches[1], 10, 32)
if errParsingInt != nil { if errParsingInt != nil {
return 0, errParsingInt return 0, errParsingInt
} }
@ -198,7 +198,7 @@ func unwrap(value string) string {
func numberValue() lex.Action { func numberValue() lex.Action {
return func(s *lex.Scanner, m *machines.Match) (interface{}, error) { return func(s *lex.Scanner, m *machines.Match) (interface{}, error) {
var numberString = string(m.Bytes) var numberString = string(m.Bytes)
var number, errParsingInt = strconv.ParseInt(numberString, 10, 64) // nolint var number, errParsingInt = strconv.ParseInt(numberString, 10, 64)
if errParsingInt != nil { if errParsingInt != nil {
return nil, errParsingInt return nil, errParsingInt
} }
@ -212,7 +212,7 @@ func hexValue() lex.Action {
var originalString = string(m.Bytes) var originalString = string(m.Bytes)
var numberString = originalString[2:] var numberString = originalString[2:]
log.Debugf("numberString: %v", numberString) log.Debugf("numberString: %v", numberString)
var number, errParsingInt = strconv.ParseInt(numberString, 16, 64) // nolint var number, errParsingInt = strconv.ParseInt(numberString, 16, 64)
if errParsingInt != nil { if errParsingInt != nil {
return nil, errParsingInt return nil, errParsingInt
} }
@ -224,7 +224,7 @@ func hexValue() lex.Action {
func floatValue() lex.Action { func floatValue() lex.Action {
return func(s *lex.Scanner, m *machines.Match) (interface{}, error) { return func(s *lex.Scanner, m *machines.Match) (interface{}, error) {
var numberString = string(m.Bytes) var numberString = string(m.Bytes)
var number, errParsingInt = strconv.ParseFloat(numberString, 64) // nolint var number, errParsingInt = strconv.ParseFloat(numberString, 64)
if errParsingInt != nil { if errParsingInt != nil {
return nil, errParsingInt return nil, errParsingInt
} }

View File

@ -203,10 +203,10 @@ func recursiveNodeEqual(lhs *yaml.Node, rhs *yaml.Node) bool {
func parseInt(numberString string) (string, int64, error) { func parseInt(numberString string) (string, int64, error) {
if strings.HasPrefix(numberString, "0x") || if strings.HasPrefix(numberString, "0x") ||
strings.HasPrefix(numberString, "0X") { strings.HasPrefix(numberString, "0X") {
num, err := strconv.ParseInt(numberString[2:], 16, 64) // nolint num, err := strconv.ParseInt(numberString[2:], 16, 64)
return "0x%X", num, err return "0x%X", num, err
} }
num, err := strconv.ParseInt(numberString, 10, 64) // nolint num, err := strconv.ParseInt(numberString, 10, 64)
return "%v", num, err return "%v", num, err
} }

View File

@ -44,7 +44,7 @@ func hasOperator(d *dataTreeNavigator, context Context, expressionNode *Expressi
case yaml.SequenceNode: case yaml.SequenceNode:
candidateHasKey := false candidateHasKey := false
if wanted.Tag == "!!int" { if wanted.Tag == "!!int" {
var number, errParsingInt = strconv.ParseInt(wantedKey, 10, 64) // nolint var number, errParsingInt = strconv.ParseInt(wantedKey, 10, 64)
if errParsingInt != nil { if errParsingInt != nil {
return Context{}, errParsingInt return Context{}, errParsingInt
} }

View File

@ -129,7 +129,7 @@ func copyFromHeader(title string, out *os.File) error {
if os.IsNotExist(err) { if os.IsNotExist(err) {
return nil return nil
} }
in, err := os.Open(source) // nolint gosec in, err := os.Open(source)
if err != nil { if err != nil {
return err return err
} }