mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +02:00
Enable intrange linter, and fix warnings
This commit is contained in:
@ -33,7 +33,7 @@ func (self *CommitDescriptionPanelDriver) AddNewline() *CommitDescriptionPanelDr
|
||||
|
||||
func (self *CommitDescriptionPanelDriver) GoToBeginning() *CommitDescriptionPanelDriver {
|
||||
numLines := len(self.getViewDriver().getView().BufferLines())
|
||||
for i := 0; i < numLines; i++ {
|
||||
for range numLines {
|
||||
self.t.pressFast("<up>")
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ func RunTests(args RunTestArgs) error {
|
||||
filepath.Join(testDir, test.Name()),
|
||||
)
|
||||
|
||||
for i := 0; i < args.MaxAttempts; i++ {
|
||||
for i := range args.MaxAttempts {
|
||||
err := runTest(test, args, paths, projectRootDir, gitVersion)
|
||||
if err != nil {
|
||||
if i == args.MaxAttempts-1 {
|
||||
|
@ -257,7 +257,7 @@ func (self *Shell) CreateNCommitsStartingAt(n, startIndex int) *Shell {
|
||||
// Only to be used in demos, because the list might change and we don't want
|
||||
// tests to break when it does.
|
||||
func (self *Shell) CreateNCommitsWithRandomMessages(n int) *Shell {
|
||||
for i := 0; i < n; i++ {
|
||||
for i := range n {
|
||||
file := RandomFiles[i]
|
||||
self.CreateFileAndAdd(
|
||||
file.Name,
|
||||
@ -286,7 +286,7 @@ func (self *Shell) CreateRepoHistory() *Shell {
|
||||
totalCommits := 0
|
||||
|
||||
// Generate commits
|
||||
for i := 0; i < numInitialCommits; i++ {
|
||||
for i := range numInitialCommits {
|
||||
author := authors[i%numAuthors]
|
||||
commitMessage := RandomCommitMessages[totalCommits%len(RandomCommitMessages)]
|
||||
|
||||
@ -296,7 +296,7 @@ func (self *Shell) CreateRepoHistory() *Shell {
|
||||
}
|
||||
|
||||
// Generate branches and merges
|
||||
for i := 0; i < numBranches; i++ {
|
||||
for i := range numBranches {
|
||||
// We'll have one author creating all the commits in the branch
|
||||
author := authors[i%numAuthors]
|
||||
branchName := RandomBranchNames[i%len(RandomBranchNames)]
|
||||
@ -309,7 +309,7 @@ func (self *Shell) CreateRepoHistory() *Shell {
|
||||
self.NewBranchFrom(branchName, fmt.Sprintf("master~%d", commitOffset))
|
||||
|
||||
numCommitsInBranch := rand.Intn(maxCommitsPerBranch) + 1
|
||||
for j := 0; j < numCommitsInBranch; j++ {
|
||||
for range numCommitsInBranch {
|
||||
commitMessage := RandomCommitMessages[totalCommits%len(RandomCommitMessages)]
|
||||
|
||||
self.SetAuthor(author, "")
|
||||
|
@ -44,7 +44,7 @@ func (self *ViewDriver) Clear() *ViewDriver {
|
||||
// clearing multiple times in case there's multiple lines
|
||||
// (the clear button only clears a single line at a time)
|
||||
maxAttempts := 100
|
||||
for i := 0; i < maxAttempts+1; i++ {
|
||||
for i := range maxAttempts + 1 {
|
||||
if self.getView().Buffer() == "" {
|
||||
break
|
||||
}
|
||||
@ -104,7 +104,7 @@ func (self *ViewDriver) ContainsLines(matchers ...*TextMatcher) *ViewDriver {
|
||||
|
||||
startIdx, endIdx := self.getSelectedRange()
|
||||
|
||||
for i := 0; i < len(lines)-len(matchers)+1; i++ {
|
||||
for i := range len(lines) - len(matchers) + 1 {
|
||||
matches := true
|
||||
for j, matcher := range matchers {
|
||||
checkIsSelected, matcher := matcher.checkIsSelected() // strip the IsSelected matcher out
|
||||
@ -375,11 +375,11 @@ func (self *ViewDriver) Focus() *ViewDriver {
|
||||
currentViewName := self.t.gui.CurrentContext().GetViewName()
|
||||
currentViewTabIndex := lo.IndexOf(window.viewNames, currentViewName)
|
||||
if tabIndex > currentViewTabIndex {
|
||||
for i := 0; i < tabIndex-currentViewTabIndex; i++ {
|
||||
for range tabIndex - currentViewTabIndex {
|
||||
self.t.press(self.t.keys.Universal.NextTab)
|
||||
}
|
||||
} else if tabIndex < currentViewTabIndex {
|
||||
for i := 0; i < currentViewTabIndex-tabIndex; i++ {
|
||||
for range currentViewTabIndex - tabIndex {
|
||||
self.t.press(self.t.keys.Universal.PrevTab)
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@ func (self *ViewDriver) NavigateToLine(matcher *TextMatcher) *ViewDriver {
|
||||
keyPress = func() { self.SelectPreviousItem() }
|
||||
}
|
||||
|
||||
for i := 0; i < maxNumKeyPresses; i++ {
|
||||
for range maxNumKeyPresses {
|
||||
keyPress()
|
||||
idx := self.getSelectedLineIdx()
|
||||
// It is important to use view.BufferLines() here and not lines, because it
|
||||
|
@ -18,7 +18,7 @@ func commonSetup(shell *Shell) {
|
||||
repoStartDaysAgo := 100
|
||||
|
||||
for _, authorInfo := range authors {
|
||||
for i := 0; i < authorInfo.numberOfCommits; i++ {
|
||||
for i := range authorInfo.numberOfCommits {
|
||||
authorEmail := strings.ToLower(strings.ReplaceAll(authorInfo.name, " ", ".")) + "@email.com"
|
||||
commitMessage := fmt.Sprintf("commit %d", i)
|
||||
|
||||
|
Reference in New Issue
Block a user