Skip to content

Commit

Permalink
Refactor: Use early return
Browse files Browse the repository at this point in the history
  • Loading branch information
andreynering committed Nov 2, 2022
1 parent fd71dfd commit a990ffe
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ func (e *Executor) readTaskfile() error {

func (e *Executor) setupFuzzyModel() {
if e.Taskfile != nil {
model := fuzzy.NewModel()
model.SetThreshold(1) // because we want to build grammar based on every task name
return
}

var words []string
for taskName := range e.Taskfile.Tasks {
words = append(words, taskName)
model := fuzzy.NewModel()
model.SetThreshold(1) // because we want to build grammar based on every task name

for _, task := range e.Taskfile.Tasks {
words = append(words, task.Aliases...)
}
}
var words []string
for taskName := range e.Taskfile.Tasks {
words = append(words, taskName)

model.Train(words)
e.fuzzyModel = model
for _, task := range e.Taskfile.Tasks {
words = append(words, task.Aliases...)
}
}

model.Train(words)
e.fuzzyModel = model
}

func (e *Executor) setupTempDir() error {
Expand Down

0 comments on commit a990ffe

Please sign in to comment.