cryptosense / ocamllint

Detect common errors in OCaml code
BSD 2-Clause "Simplified" License
68 stars 3 forks source link

Mechanism to add custom rules #3

Open emillon opened 8 years ago

emillon commented 8 years ago

It would be nice to have a way to express custom rules, tied to a particular codebase (and in particular, rules that can not be contributed to the builtin rule base itself). The mechanism described in #2 can be used for that:

let _ =
    let open Ocamllint.Config in
    add_rule_expr @@ function
      | [%expr List.concat (List.map [%e? _] [%e? _])] ->
          Some "Use MyPrivateModule.concat_map"
      | _ -> None