superfly / flyctl

Function call can be replaced with helper function CRT-A0010
Anti-pattern
Major
25 days ago4 years old
use strings.ReplaceAll method in strings.Replace(cmd.CommandPath(), " ", "_", -1)
168		}
169	}
170
171	basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md"172	filename := filepath.Join(dir, basename)
173	f, err := os.Create(filename)
174	if err != nil {
use strings.ReplaceAll method in strings.Replace(link, " ", "_", -1)
126			parent := cmd.Parent()
127			pname := parent.CommandPath()
128			link := pname + ".md"
129			link = strings.Replace(link, " ", "_", -1)130			buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
131			cmd.VisitParents(func(c *cobra.Command) {
132				if c.DisableAutoGenTag {
use strings.ReplaceAll method in strings.Replace(link, " ", "_", -1)
106			}
107			cname := name + " " + child.Name()
108			link := cname + ".md"
109			link = strings.Replace(link, " ", "_", -1)110			buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", child.Name(), linkHandler(link), child.Short))
111		}
112		buf.WriteString("\n")
use strings.ReplaceAll method in strings.Replace(strings.Join(keys, " "), "_", " ", -1)
 86			}
 87		}
 88		obj[0] = append(obj[0], value)
 89		colName := strings.Title(strings.Replace(strings.Join(keys, " "), "_", " ", -1)) 90		cols = append(cols, colName)
 91	}
 92