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

Function compileRule

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

Source from the content-addressed store, hash-verified

185}
186
187func compileRule(args []string, _ *core.CLIFlags) error {
188 if len(args) != 1 {
189 return core.NewE100("compile", errors.New("one argument expected"))
190 }
191
192 cfg, err := core.NewConfig(&core.CLIFlags{})
193 if err != nil {
194 return err
195 }
196
197 path := args[0]
198 name := filepath.Base(path)
199
200 mgr, err := check.NewManager(cfg)
201 if err != nil {
202 return err
203 }
204
205 err = mgr.AddRuleFromFile(name, path)
206 if err != nil {
207 return err
208 }
209
210 rule := CompiledRule{Pattern: mgr.Rules()[name].Pattern()}
211 return printJSON(rule)
212}
213
214func runRule(args []string, _ *core.CLIFlags) error {
215 if len(args) != 2 {

Callers

nothing calls this directly

Calls 7

AddRuleFromFileMethod · 0.95
RulesMethod · 0.95
NewE100Function · 0.92
NewConfigFunction · 0.92
NewManagerFunction · 0.92
printJSONFunction · 0.85
PatternMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…