Skip to content

Commit

Permalink
address lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdevivo committed Jun 12, 2020
1 parent f920513 commit 742c6e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
3 changes: 2 additions & 1 deletion cmd/commands/todos.go
Expand Up @@ -97,7 +97,8 @@ var todosCmd = &cobra.Command{
handleError(err, s)

} else {
todos.WriteTodos(foundToDos, os.Stdout)
err := todos.WriteTodos(foundToDos, os.Stdout)
handleError(err, s)
}

},
Expand Down
6 changes: 5 additions & 1 deletion pkg/comments/comments.go
Expand Up @@ -116,7 +116,7 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
return err
}
defer fileIter.Close()
fileIter.ForEach(func(file *object.File) error {
err = fileIter.ForEach(func(file *object.File) error {
if file.Mode.IsFile() {
wg.Add(1)
go func() {
Expand All @@ -138,6 +138,10 @@ func SearchCommit(commit *object.Commit, cb func(*Comment)) error {
return nil
})

if err != nil {
return err
}

wg.Wait()
return nil
}
29 changes: 0 additions & 29 deletions pkg/todos/todos.go
@@ -1,14 +1,12 @@
package todos

import (
"bufio"
"context"
"strings"

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

// ToDo represents a ToDo item
Expand Down Expand Up @@ -100,33 +98,6 @@ func (t ToDos) CountWithCommits() (count int) {
return count
}

func (t *ToDo) existsInCommit(commit *object.Commit) (bool, error) {
f, err := commit.File(t.FilePath)
if err != nil {
if err == object.ErrFileNotFound {
return false, nil
}
return false, err
}
r, err := f.Reader()
if err != nil {
return false, err
}
defer r.Close()
s := bufio.NewScanner(r)
for s.Scan() {
line := s.Text()
if strings.Contains(line, t.Comment.String()) {
return true, nil
}
}
err = s.Err()
if err != nil {
return false, err
}
return false, nil
}

// FindBlame sets the blame information on each todo in a set of todos
func (t *ToDos) FindBlame(ctx context.Context, dir string) error {
fileMap := make(map[string]ToDos)
Expand Down

0 comments on commit 742c6e4

Please sign in to comment.