diff --git a/main.go b/main.go index ee3108a..21e3990 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,10 @@ import "fmt" // TODO check if to-do is just above a function or struct, if so assume the to-do is about the function +// TODO output to a file + +// TODO add execution params to the running of the application, allowing to set the path, keywords, ignore list, language, etc + const ( statusDir = "../status-go" ignore = statusDir + "/vendor" diff --git a/node.go b/node.go index 2de6ca4..b39c944 100644 --- a/node.go +++ b/node.go @@ -71,11 +71,11 @@ func (n node) toString(indent int) string { switch c.Type { case DIR: out += idnt + "- 📁 " + c.Name + "\n" - out += c.toString(indent+1) + out += c.toString(indent + 1) case FILE: out += idnt + "- 📃 " + c.Name + "\n" for _, t := range c.Todos { - todoIdnt := idnt+baseIdnt+baseIdnt + todoIdnt := idnt + baseIdnt + baseIdnt ts := strings.ReplaceAll(t.String(), "\n", "\n"+todoIdnt) out += idnt + baseIdnt + "- ⬜ Todo:\n" + todoIdnt + ts + "\n" } @@ -83,4 +83,4 @@ func (n node) toString(indent int) string { } return out -} \ No newline at end of file +} diff --git a/todo.go b/todo.go index 87fc766..8e557b6 100644 --- a/todo.go +++ b/todo.go @@ -10,7 +10,7 @@ type todo struct { Description string LineNumber int RelatedFuncOrType string - filePathSlice []string + filePathSlice []string } func (t *todo) Path() []string { @@ -42,10 +42,10 @@ func (t *todo) String() string { l3 := "*Description* : " if t.RelatedFuncOrType != "" { - out += l1+ " `" + t.RelatedFuncOrType + "`" + "\n" + out += l1 + " `" + t.RelatedFuncOrType + "`" + "\n" } return out + fmt.Sprintf("%s %d \n", l2, t.LineNumber) + l3 + t.Description -} \ No newline at end of file +} diff --git a/todo_finder.go b/todo_finder.go index 1d0a747..a2bb149 100644 --- a/todo_finder.go +++ b/todo_finder.go @@ -11,8 +11,8 @@ import ( type TodoFinder struct { // regex related fields entityTracker *entityTracker - todoRegex *regexp.Regexp - lineRegex *regexp.Regexp + todoRegex *regexp.Regexp + lineRegex *regexp.Regexp // results store FoundTable []*todo @@ -28,7 +28,7 @@ func NewTodoFinder() (TodoFinder, error) { tf := TodoFinder{ FoundTable: []*todo{}, foundTree: &node{Name: "root", Type: DIR}, - keywords: []string{"todo", "fixme"}, + keywords: []string{"todo", "fixme"}, } return tf, tf.init() @@ -122,7 +122,7 @@ func (tf *TodoFinder) FindInDir(dir string) error { return nil } -func (tf TodoFinder) isGoFile(name string) bool { +func (tf TodoFinder) isGoFile(name string) bool { if len(name) < 3 { return false } diff --git a/todo_finder_test.go b/todo_finder_test.go index 5f49427..6a4eea2 100644 --- a/todo_finder_test.go +++ b/todo_finder_test.go @@ -6,7 +6,7 @@ import ( ) func TestNode_AddToTree(t *testing.T) { - n := &node{Name: "root", Type: "dir"} + n := &node{Name: "root", Type: DIR} td := &todo{ Filepath: "../status-go/admin/sales/donkeys/pokemon/gif.go", Description: "this looks borken",