Updated project todos and go fmt
This commit is contained in:
parent
d0d6297b7d
commit
715a868281
4
main.go
4
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"
|
||||
|
|
6
node.go
6
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
|
||||
}
|
||||
}
|
||||
|
|
6
todo.go
6
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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue