(args []string, _ *core.CLIFlags)
| 185 | } |
| 186 | |
| 187 | func 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 | |
| 214 | func runRule(args []string, _ *core.CLIFlags) error { |
| 215 | if len(args) != 2 { |
nothing calls this directly
no test coverage detected
searching dependent graphs…