Add nakedret, unconvert, wastedassign, stylecheck and nolintlint linters to improve code readability - nakedret - https://github.com/alexkohler/nakedret - nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length. - unconvert - https://github.com/mdempsky/unconvert - Remove unnecessary type conversions - wastedassign - https://github.com/sanposhiho/wastedassign - wastedassign finds wasted assignment statements. - notlintlint - Reports ill-formed or insufficient nolint directives - stylecheck - https://staticcheck.io/docs/checks/#ST - keep style consistent - excluded: [ST1003 - Poorly chosen identifier](https://staticcheck.io/docs/checks/#ST1003) and [ST1005 - Incorrectly formatted error string](https://staticcheck.io/docs/checks/#ST1005)
Showing the changes to services/gitdiff/gitdiff.go (1 of 147 files). Show all
Unified · Split
| @@ -1011,7 +1011,7 @@ parsingLoop: · 1010 unmodified lines | ||
| 1011 | 1011 | |
| 1012 | 1012 | func skipToNextDiffHead(input *bufio.Reader) (line string, err error) { |
| 1013 | 1013 | // need to skip until the next cmdDiffHead |
| 1014 | − isFragment, wasFragment := false, false | |
| 1014 | + var isFragment, wasFragment bool | |
| 1015 | 1015 | var lineBytes []byte |
| 1016 | 1016 | for { |
| 1017 | 1017 | lineBytes, isFragment, err = input.ReadLine() |
| @@ -1036,7 +1036,7 @@ func skipToNextDiffHead(input *bufio.Reader) (line string, err error) { · 18 unmodified lines | ||
| 1036 | 1036 | } |
| 1037 | 1037 | line += tail |
| 1038 | 1038 | } |
| 1039 | − return | |
| 1039 | + return line, err | |
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | func parseHunks(curFile *DiffFile, maxLines, maxLineCharacters int, input *bufio.Reader) (lineBytes []byte, isFragment bool, err error) { |
| @@ -1257,8 +1257,7 @@ func createDiffFile(diff *Diff, line string) *DiffFile { · 214 unmodified lines | ||
| 1257 | 1257 | |
| 1258 | 1258 | rd := strings.NewReader(line[len(cmdDiffHead):] + " ") |
| 1259 | 1259 | curFile.Type = DiffFileChange |
| 1260 | − oldNameAmbiguity := false | |
| 1261 | − newNameAmbiguity := false | |
| 1260 | + var oldNameAmbiguity, newNameAmbiguity bool | |
| 1262 | 1261 | |
| 1263 | 1262 | curFile.OldName, oldNameAmbiguity = readFileName(rd) |
| 1264 | 1263 | curFile.Name, newNameAmbiguity = readFileName(rd) |