Opinionated OCaml linter with Merlin integration for code quality, naming conventions, and style checks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-rego: reject modulo on non-integer floats

OPA's [%] operator is integer-only and raises [modulo on floating-
point number] when given a non-integer. Add the same check.

-33
-18
lib/ast.ml
··· 284 284 m "Failed to parse %s: %s" filename (Printexc.to_string exn)); 285 285 [] 286 286 287 - let rec pp_expr ppf = function 288 - | If_then_else { cond; then_expr; else_expr } -> 289 - Fmt.pf ppf "If(%a, %a, %a)" pp_expr cond pp_expr then_expr 290 - (Fmt.option pp_expr) else_expr 291 - | Match { cases; _ } -> Fmt.pf ppf "Match(%d)" cases 292 - | Try { expr; handlers } -> Fmt.pf ppf "Try(%a, %d)" pp_expr expr handlers 293 - | Function { params; body } -> Fmt.pf ppf "Fun(%d, %a)" params pp_expr body 294 - | Let { bindings; body } -> 295 - Fmt.pf ppf "Let([%a], %a)" 296 - (Fmt.list ~sep:Fmt.comma (fun ppf (n, e) -> 297 - Fmt.pf ppf "%s=%a" n pp_expr e)) 298 - bindings pp_expr body 299 - | Sequence exprs -> 300 - Fmt.pf ppf "Seq[%a]" (Fmt.list ~sep:Fmt.comma pp_expr) exprs 301 - | List -> Fmt.pf ppf "List" 302 - | Record { fields } -> Fmt.pf ppf "Record(%d)" fields 303 - | Other -> Fmt.pf ppf "Other" 304 - 305 287 (** Standard functions for type t *) 306 288 let equal a b = a.functions = b.functions 307 289
-3
lib/ast.mli
··· 70 70 node. *) 71 71 end 72 72 73 - val pp_expr : expr Fmt.t 74 - (** [pp_expr] pretty-prints an AST expression for debugging. *) 75 - 76 73 val trailing_record_fields : expr -> int 77 74 (** [trailing_record_fields expr] returns the number of fields in a trailing 78 75 record literal at the tail position of [expr]. Returns 0 if the expression
-3
lib/outline.ml
··· 18 18 | Method 19 19 | Label 20 20 21 - type position = Merlin.position = { line : int; col : int } 22 21 type item = Merlin.outline_item 23 22 type t = Merlin.outline 24 23 ··· 34 33 (* {2 Merlint-specific helpers} *) 35 34 36 35 let pp = Merlin.pp_outline 37 - let pp_item = Merlin.pp_outline_item 38 - let pp_kind = Merlin.pp_symbol_kind 39 36 40 37 let location filename (item : item) = 41 38 let loc = item.location in
-9
lib/outline.mli
··· 18 18 | Method 19 19 | Label 20 20 21 - type position = Merlin.position = { line : int; col : int } 22 - (** Position in file. *) 23 - 24 21 type item = Merlin.outline_item 25 22 (** Outline item. *) 26 23 ··· 52 49 53 50 val pp : t Fmt.t 54 51 (** [pp] is a pretty-printer for outline. *) 55 - 56 - val pp_item : item Fmt.t 57 - (** [pp_item] is a pretty-printer for outline item. *) 58 - 59 - val pp_kind : kind Fmt.t 60 - (** [pp_kind] is a pretty-printer for symbol kind. *) 61 52 62 53 val location : string -> item -> Location.t option 63 54 (** [location filename item] extracts location for merlint's Location.t. *)