Does OCaml ecosystem have tools similar to rubocop or reek from Ruby's ecosystem?

Does OCaml ecosystem have tools similar to rubocop or reek from Ruby’s ecosystem? If you’re not familiar with rubocop [https://github.com/rubocop-hq/rubocop] and reek [https://github.com/troessner/reek]: both are tools for style checking and in some cases they can automatically make improvements.

The static code analysis part (and much better one indeed) is already built into the type system (compiler does all the checks). For formatting, have a look into these. I use them and they are great:

Also there are tools for automatic conversion between ReasonML and OCaml syntax, which I can’t remember where to find right now.

2 Likes

I’m familiar with Rubocop (I use Ruby at work), and unfortunately, there is no such thing for OCaml, which is a shame, IMO. Maybe one day. This is the kind of project I’d love to undertake in the future.

For those not familiar with Rubocop, it’s a static analyzer that checks style, layout, and all kinds of stuff. You can take a peek at all the things it does here.

The Jane Street folks have a PPX that checks style etc., and they made it openly available. I am pretty sure a quick hunt will find it. (Yes, a PPX can check style, since it’s a plug-in to the compiler that gets a position-annotated AST.)

1 Like

There’s also https://github.com/cryptosense/ocamllint

2 Likes