MCPcopy Create free account
hub / github.com/vale-cli/vale / runRule

Function runRule

cmd/vale/command.go:214–245  ·  view source on GitHub ↗
(args []string, _ *core.CLIFlags)

Source from the content-addressed store, hash-verified

212}
213
214func runRule(args []string, _ *core.CLIFlags) error {
215 if len(args) != 2 {
216 return core.NewE100("run", errors.New("two arguments expected"))
217 }
218
219 cfg, err := core.NewConfig(&core.CLIFlags{})
220 if err != nil {
221 return err
222 }
223
224 cfg.MinAlertLevel = 0
225 cfg.GBaseStyles = []string{"Test"}
226 cfg.Flags.InExt = ".txt" // default value
227
228 linter, err := lint.NewLinter(cfg)
229 if err != nil {
230 return err
231 }
232
233 err = linter.Manager.AddRuleFromFile("Test.Rule", args[0])
234 if err != nil {
235 return err
236 }
237
238 linted, err := linter.Lint([]string{args[1]}, "*")
239 if err != nil {
240 return err
241 }
242
243 PrintJSONAlerts(linted)
244 return nil
245}
246
247func printVars(_ []string, flags *core.CLIFlags) error {
248 if flags.Output == "JSON" {

Callers

nothing calls this directly

Calls 6

LintMethod · 0.95
NewE100Function · 0.92
NewConfigFunction · 0.92
NewLinterFunction · 0.92
PrintJSONAlertsFunction · 0.85
AddRuleFromFileMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…