(typ string, expectedLen int, toCheck string)
| 83 | } |
| 84 | |
| 85 | func validateMaxLineLength(typ string, expectedLen int, toCheck string) (*lint.Issue, bool) { |
| 86 | if expectedLen < 0 || toCheck == "" { |
| 87 | return nil, true |
| 88 | } |
| 89 | |
| 90 | var msgs []string |
| 91 | index := 0 |
| 92 | commit.ForEachLine(toCheck, func(line string) bool { |
| 93 | index++ |
| 94 | if actualLen := len(line); actualLen > expectedLen { |
| 95 | msgs = append(msgs, fmt.Sprintf("in line %d, length is %d", index, actualLen)) |
| 96 | } |
| 97 | return true |
| 98 | }) |
| 99 | |
| 100 | if len(msgs) == 0 { |
| 101 | return nil, true |
| 102 | } |
| 103 | |
| 104 | desc := formMaxLineLenDesc(typ, expectedLen) |
| 105 | return lint.NewIssue(desc, msgs...), false |
| 106 | } |
| 107 | |
| 108 | func setBoolArg(retVal *bool, arg interface{}) error { |
| 109 | boolVal, err := toBool(arg) |
no test coverage detected