Skip to content

Commit 5abe681

Browse files
committed
Better variable names and camelcase
1 parent b510356 commit 5abe681

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

services/gitdiff/csv.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,35 +178,35 @@ func createCsvDiff(diffFile *DiffFile, baseReader *csv.Reader, headReader *csv.R
178178
}
179179

180180
for i := 0; i < len(a2b); i++ {
181-
acell, ae := getCell(arow, i)
181+
aCell, aErr := getCell(arow, i)
182182

183183
if a2b[i] == unmappedColumn {
184-
cells[i] = &TableDiffCell{LeftCell: acell, Type: TableDiffCellDel}
184+
cells[i] = &TableDiffCell{LeftCell: aCell, Type: TableDiffCellDel}
185185
} else {
186-
bcell, be := getCell(brow, a2b[i])
187-
188-
var celltype TableDiffCellType
189-
if ae != nil {
190-
celltype = TableDiffCellAdd
191-
} else if be != nil {
192-
celltype = TableDiffCellDel
193-
} else if acell == bcell {
194-
celltype = TableDiffCellEqual
186+
bCell, bErr := getCell(brow, a2b[i])
187+
188+
var cellType TableDiffCellType
189+
if aErr != nil {
190+
cellType = TableDiffCellAdd
191+
} else if bErr != nil {
192+
cellType = TableDiffCellDel
193+
} else if aCell == bCell {
194+
cellType = TableDiffCellEqual
195195
} else {
196-
celltype = TableDiffCellChanged
196+
cellType = TableDiffCellChanged
197197
}
198198

199-
cells[i] = &TableDiffCell{LeftCell: acell, RightCell: bcell, Type: celltype}
199+
cells[i] = &TableDiffCell{LeftCell: aCell, RightCell: bCell, Type: cellType}
200200
}
201201
}
202202
cellsIndex := 0
203203
for i := 0; i < len(b2a); i++ {
204204
if b2a[i] == unmappedColumn {
205-
bcell, _ := getCell(brow, i)
205+
bCell, _ := getCell(brow, i)
206206
if cells[cellsIndex] != nil && len(cells) >= cellsIndex+1 {
207207
copy(cells[cellsIndex+1:], cells[cellsIndex:])
208208
}
209-
cells[cellsIndex] = &TableDiffCell{RightCell: bcell, Type: TableDiffCellAdd}
209+
cells[cellsIndex] = &TableDiffCell{RightCell: bCell, Type: TableDiffCellAdd}
210210
} else if cellsIndex < b2a[i] {
211211
cellsIndex = b2a[i]
212212
}
@@ -300,9 +300,9 @@ func tryMapColumnsByContent(a *csvReader, a2b []int, b *csvReader, b2a []int) {
300300
rows := util.Min(maxRowsToInspect, util.Max(0, util.Min(len(a.buffer), len(b.buffer))-1))
301301
same := 0
302302
for j := 1; j <= rows; j++ {
303-
acell, ea := getCell(a.buffer[j], i)
304-
bcell, eb := getCell(b.buffer[j], bStart)
305-
if ea == nil && eb == nil && acell == bcell {
303+
aCell, aErr := getCell(a.buffer[j], i)
304+
bCell, bErr := getCell(b.buffer[j], bStart)
305+
if aErr == nil && bErr == nil && aCell == bCell {
306306
same++
307307
}
308308
}

0 commit comments

Comments
 (0)