1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

Enable intrange linter, and fix warnings

This commit is contained in:
Stefan Haller
2025-06-30 11:03:00 +02:00
parent 1e92d8b7f3
commit 0471dbaa84
21 changed files with 35 additions and 34 deletions

View File

@ -257,11 +257,11 @@ func TestListRenderer_ModelIndexToViewIndex_and_back(t *testing.T) {
// Need to render first so that it knows the non-model items
self.renderLines(-1, -1)
for i := 0; i < len(s.modelIndices); i++ {
for i := range len(s.modelIndices) {
assert.Equal(t, s.expectedViewIndices[i], self.ModelIndexToViewIndex(s.modelIndices[i]))
}
for i := 0; i < len(s.viewIndices); i++ {
for i := range len(s.viewIndices) {
assert.Equal(t, s.expectedModelIndices[i], self.ViewIndexToModelIndex(s.viewIndices[i]))
}
})

View File

@ -180,7 +180,7 @@ func (self *FilesController) Explode(v *gocui.View, onDone func()) {
self.c.OnWorker(func(_ gocui.Task) error {
max := 25
for i := 0; i < max; i++ {
for i := range max {
image := getExplodeImage(width, height, i, max)
style := styles[(i*len(styles)/max)%len(styles)]
coloredImage := style.Sprint(image)
@ -229,8 +229,8 @@ func getExplodeImage(width int, height int, frame int, max int) string {
innerRadius = (progress - 0.5) * 2 * maxRadius
}
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
for y := range height {
for x := range width {
// calculate distance from center, scale x by 2 to compensate for character aspect ratio
distance := math.Hypot(float64(x-centerX), float64(y-centerY)*2)

View File

@ -79,7 +79,7 @@ func RenderAux(pipeSets [][]Pipe, commits []*models.Commit, selectedCommitHashPt
wg := sync.WaitGroup{}
wg.Add(maxProcs)
for i := 0; i < maxProcs; i++ {
for i := range maxProcs {
go func() {
from := i * perProc
to := (i + 1) * perProc

View File

@ -579,7 +579,7 @@ func generateCommits(hashPool *utils.StringPool, count int) []*models.Commit {
parentCount := rnd.Intn(2) + 1
parentHashes := currentCommit.Parents()
for j := 0; j < parentCount; j++ {
for j := range parentCount {
reuseParent := rnd.Intn(6) != 1 && j <= len(pool)-1 && j != 0
var newParent *models.Commit
if reuseParent {