Skip to content

Commit 742c6e4

Browse files
committed
address lint issues
1 parent f920513 commit 742c6e4

File tree

3 files changed

+7
-31
lines changed

3 files changed

+7
-31
lines changed

cmd/commands/todos.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ var todosCmd = &cobra.Command{
9797
handleError(err, s)
9898

9999
} else {
100-
todos.WriteTodos(foundToDos, os.Stdout)
100+
err := todos.WriteTodos(foundToDos, os.Stdout)
101+
handleError(err, s)
101102
}
102103

103104
},

pkg/comments/comments.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
116116
return err
117117
}
118118
defer fileIter.Close()
119-
fileIter.ForEach(func(file *object.File) error {
119+
err = fileIter.ForEach(func(file *object.File) error {
120120
if file.Mode.IsFile() {
121121
wg.Add(1)
122122
go func() {
@@ -138,6 +138,10 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
138138
return nil
139139
})
140140

141+
if err != nil {
142+
return err
143+
}
144+
141145
wg.Wait()
142146
return nil
143147
}

pkg/todos/todos.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package todos
22

33
import (
4-
"bufio"
54
"context"
65
"strings"
76

87
"github.com/augmentable-dev/tickgit/pkg/blame"
98
"github.com/augmentable-dev/tickgit/pkg/comments"
109
"github.com/dustin/go-humanize"
11-
"gopkg.in/src-d/go-git.v4/plumbing/object"
1210
)
1311

1412
// ToDo represents a ToDo item
@@ -100,33 +98,6 @@ func (t ToDos) CountWithCommits() (count int) {
10098
return count
10199
}
102100

103-
func (t *ToDo) existsInCommit(commit *object.Commit) (bool, error) {
104-
f, err := commit.File(t.FilePath)
105-
if err != nil {
106-
if err == object.ErrFileNotFound {
107-
return false, nil
108-
}
109-
return false, err
110-
}
111-
r, err := f.Reader()
112-
if err != nil {
113-
return false, err
114-
}
115-
defer r.Close()
116-
s := bufio.NewScanner(r)
117-
for s.Scan() {
118-
line := s.Text()
119-
if strings.Contains(line, t.Comment.String()) {
120-
return true, nil
121-
}
122-
}
123-
err = s.Err()
124-
if err != nil {
125-
return false, err
126-
}
127-
return false, nil
128-
}
129-
130101
// FindBlame sets the blame information on each todo in a set of todos
131102
func (t *ToDos) FindBlame(ctx context.Context, dir string) error {
132103
fileMap := make(map[string]ToDos)

0 commit comments

Comments
 (0)