* gofumpt -w -l . * gofumpt -w -l -extra . * Add linter * manual fix * change make fmt
Showing the changes to services/gitdiff/gitdiff.go (1 of 423 files). Show all
Unified · Split
| @@ -190,9 +190,11 @@ var ( · 189 unmodified lines | |||
| 190 | codeTagSuffix = []byte(`</span>`) | 190 | codeTagSuffix = []byte(`</span>`) |
| 191 | ) | 191 | ) |
| 192 | 192 | ||
| 193 | var unfinishedtagRegex = regexp.MustCompile(`<[^>]*$`) | 193 | var ( |
| 194 | var trailingSpanRegex = regexp.MustCompile(`<span\s*[[:alpha:]="]*?[>]?$`) | 194 | unfinishedtagRegex = regexp.MustCompile(`<[^>]*$`) |
| 195 | var entityRegex = regexp.MustCompile(`&[#]*?[0-9[:alpha:]]*$`) | 195 | trailingSpanRegex = regexp.MustCompile(`<span\s*[[:alpha:]="]*?[>]?$`) |
| 196 | entityRegex = regexp.MustCompile(`&[#]*?[0-9[:alpha:]]*$`) | ||
| 197 | ) | ||
| 196 | 198 | ||
| 197 | // shouldWriteInline represents combinations where we manually write inline changes | 199 | // shouldWriteInline represents combinations where we manually write inline changes |
| 198 | func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool { | 200 | func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool { |
| @@ -206,7 +208,6 @@ func shouldWriteInline(diff diffmatchpatch.Diff, lineType DiffLineType) bool { · 7 unmodified lines | |||
| 206 | } | 208 | } |
| 207 | 209 | ||
| 208 | func fixupBrokenSpans(diffs []diffmatchpatch.Diff) []diffmatchpatch.Diff { | 210 | func fixupBrokenSpans(diffs []diffmatchpatch.Diff) []diffmatchpatch.Diff { |
| 209 | |||
| 210 | // Create a new array to store our fixed up blocks | 211 | // Create a new array to store our fixed up blocks |
| 211 | fixedup := make([]diffmatchpatch.Diff, 0, len(diffs)) | 212 | fixedup := make([]diffmatchpatch.Diff, 0, len(diffs)) |
| 212 | 213 | ||
| @@ -658,10 +659,10 @@ func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, · 445 unmodified lines | |||
| 658 | LastRightIdx: lastLine.RightIdx, | 659 | LastRightIdx: lastLine.RightIdx, |
| 659 | LeftIdx: leftLineCount, | 660 | LeftIdx: leftLineCount, |
| 660 | RightIdx: rightLineCount, | 661 | RightIdx: rightLineCount, |
| 661 | }} | 662 | }, |
| 663 | } | ||
| 662 | tailSection := &DiffSection{FileName: diffFile.Name, Lines: []*DiffLine{tailDiffLine}} | 664 | tailSection := &DiffSection{FileName: diffFile.Name, Lines: []*DiffLine{tailDiffLine}} |
| 663 | return tailSection | 665 | return tailSection |
| 664 | |||
| 665 | } | 666 | } |
| 666 | 667 | ||
| 667 | func getCommitFileLineCount(commit *git.Commit, filePath string) int { | 668 | func getCommitFileLineCount(commit *git.Commit, filePath string) int { |
| @@ -942,8 +943,8 @@ parsingLoop: · 274 unmodified lines | |||
| 942 | // TODO: There are numerous issues with this: | 943 | // TODO: There are numerous issues with this: |
| 943 | // - we might want to consider detecting encoding while parsing but... | 944 | // - we might want to consider detecting encoding while parsing but... |
| 944 | // - we're likely to fail to get the correct encoding here anyway as we won't have enough information | 945 | // - we're likely to fail to get the correct encoding here anyway as we won't have enough information |
| 945 | var diffLineTypeBuffers = make(map[DiffLineType]*bytes.Buffer, 3) | 946 | diffLineTypeBuffers := make(map[DiffLineType]*bytes.Buffer, 3) |
| 946 | var diffLineTypeDecoders = make(map[DiffLineType]*encoding.Decoder, 3) | 947 | diffLineTypeDecoders := make(map[DiffLineType]*encoding.Decoder, 3) |
| 947 | diffLineTypeBuffers[DiffLinePlain] = new(bytes.Buffer) | 948 | diffLineTypeBuffers[DiffLinePlain] = new(bytes.Buffer) |
| 948 | diffLineTypeBuffers[DiffLineAdd] = new(bytes.Buffer) | 949 | diffLineTypeBuffers[DiffLineAdd] = new(bytes.Buffer) |
| 949 | diffLineTypeBuffers[DiffLineDel] = new(bytes.Buffer) | 950 | diffLineTypeBuffers[DiffLineDel] = new(bytes.Buffer) |
| @@ -1539,7 +1540,8 @@ func GetWhitespaceFlag(whiteSpaceBehavior string) string { · 589 unmodified lines | |||
| 1539 | "ignore-all": "-w", | 1540 | "ignore-all": "-w", |
| 1540 | "ignore-change": "-b", | 1541 | "ignore-change": "-b", |
| 1541 | "ignore-eol": "--ignore-space-at-eol", | 1542 | "ignore-eol": "--ignore-space-at-eol", |
| 1542 | "": ""} | 1543 | "": "", |
| 1544 | } | ||
| 1543 | 1545 | ||
| 1544 | return whitespaceFlags[whiteSpaceBehavior] | 1546 | return whitespaceFlags[whiteSpaceBehavior] |
| 1545 | } | 1547 | } |