mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
add some more linters
This commit is contained in:
@ -46,6 +46,7 @@ func TestBranchGetCommitDifferences(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := NewBranchCommandsWithRunner(s.runner)
|
||||
pushables, pullables := instance.GetCommitDifferences("HEAD", "@{u}")
|
||||
@ -93,6 +94,7 @@ func TestBranchDeleteBranch(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := NewBranchCommandsWithRunner(s.runner)
|
||||
|
||||
@ -139,6 +141,7 @@ func TestBranchCheckout(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := NewBranchCommandsWithRunner(s.runner)
|
||||
s.test(instance.Checkout("test", CheckoutOptions{Force: s.force}))
|
||||
@ -218,6 +221,7 @@ func TestBranchCurrentBranchName(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := NewBranchCommandsWithRunner(s.runner)
|
||||
s.test(instance.CurrentBranchName())
|
||||
|
@ -75,6 +75,7 @@ func TestCommitCommitObj(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
userConfig := config.GetDefaultConfig()
|
||||
userConfig.Git.Commit.SignOff = s.configSignoff
|
||||
@ -109,6 +110,7 @@ func TestCommitCreateFixupCommit(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildCommitCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.CreateFixupCommit(s.sha))
|
||||
@ -147,6 +149,7 @@ func TestCommitShowCmdObj(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
userConfig := config.GetDefaultConfig()
|
||||
userConfig.Git.DiffContextSize = s.contextSize
|
||||
|
@ -27,7 +27,7 @@ func NewConfigCommands(
|
||||
return &ConfigCommands{
|
||||
Common: common,
|
||||
gitConfig: gitConfig,
|
||||
repo: repo,
|
||||
// repo: repo,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ func TestRebaseRebaseBranch(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildRebaseCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.RebaseBranch(s.arg))
|
||||
@ -62,6 +63,7 @@ func TestRebaseSkipEditorCommand(t *testing.T) {
|
||||
`^GIT_EDITOR=.*$`,
|
||||
"^LAZYGIT_CLIENT_COMMAND=EXIT_IMMEDIATELY$",
|
||||
} {
|
||||
regexStr := regexStr
|
||||
foundMatch := utils.IncludesStringFunc(envVars, func(envVar string) bool {
|
||||
return regexp.MustCompile(regexStr).MatchString(envVar)
|
||||
})
|
||||
@ -135,6 +137,7 @@ func TestRebaseDiscardOldFileChanges(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildRebaseCommands(commonDeps{
|
||||
runner: s.runner,
|
||||
|
@ -68,6 +68,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
userConfig := config.GetDefaultConfig()
|
||||
userConfig.Git.DiffContextSize = s.contextSize
|
||||
|
@ -85,6 +85,7 @@ func TestSyncPush(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildSyncCommands(commonDeps{})
|
||||
s.test(instance.PushCmdObj(s.opts))
|
||||
|
@ -53,6 +53,7 @@ func TestWorkingTreeUnstageFile(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.UnStageFile([]string{"test.txt"}, s.reset))
|
||||
@ -181,6 +182,7 @@ func TestWorkingTreeDiscardAllFileChanges(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner, removeFile: s.removeFile})
|
||||
err := instance.DiscardAllFileChanges(s.file)
|
||||
@ -296,6 +298,7 @@ func TestWorkingTreeDiff(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
userConfig := config.GetDefaultConfig()
|
||||
userConfig.Git.DiffContextSize = s.contextSize
|
||||
@ -345,6 +348,7 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
userConfig := config.GetDefaultConfig()
|
||||
userConfig.Git.DiffContextSize = s.contextSize
|
||||
@ -392,6 +396,7 @@ func TestWorkingTreeCheckoutFile(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
|
||||
@ -445,6 +450,7 @@ func TestWorkingTreeApplyPatch(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.ApplyPatch("test", "cached"))
|
||||
@ -474,6 +480,7 @@ func TestWorkingTreeDiscardUnstagedFileChanges(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.DiscardUnstagedFileChanges(s.file))
|
||||
@ -501,6 +508,7 @@ func TestWorkingTreeDiscardAnyUnstagedFileChanges(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.DiscardAnyUnstagedFileChanges())
|
||||
@ -528,6 +536,7 @@ func TestWorkingTreeRemoveUntrackedFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.RemoveUntrackedFiles())
|
||||
@ -557,6 +566,7 @@ func TestWorkingTreeResetHard(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
s := s
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner})
|
||||
s.test(instance.ResetHard(s.ref))
|
||||
|
Reference in New Issue
Block a user