Another idea that will get you part of the way there is to use refmt to automatically format the OCaml files to standard layout. This would cover 3 out of the 4 criteria because: 1. it automatically indents 2. it always reduces parentheses where it can 3. it automatically converts begin and end to parentheses. The 4th criteria could potentially be caught using grep. It's worth an experiment to see if you like the style of code generated by refmt for OCaml. It certainly does a better job at formatting reason code from my limited experiments (it doesn't seem to like vertical white space when generating OCaml, whereas it will include it if you covert the file to reason, testing version 1.13.5 as of writing). On 5 July 2017 at 00:03, Richard W.M. Jones wrote: > On Tue, Jul 04, 2017 at 03:01:28PM +0100, Richard W.M. Jones wrote: > > I have a need to make automated stylistic and syntax checks to > > a large amount of OCaml code. The sort of rules would be: > > > > - Check that indentation is used, and used consistently. > > > > - Excessive use of parentheses where not needed. > > > > - Use ( .. ) instead of begin .. end. > > > > - Flag uses of various Obj.* and unsafe_* functions. > > > > It seems to me that some of these could be tested with either camlp4 > > or ppx. I think if we allowed the checker to go back to the original > > code (eg to see if the parser parsed as block as '(' or 'begin'), > > it might be able to check all of these things. > > > > Anyway, before I start on it I'm wondering if anyone has ever > > looked at doing this kind of thing? > > Now that I actually formulate the right search terms, I see > that ocp-lint exists :-/ > > Rich. > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- -barkmadley sent from an internet enabled device http://barkmadley.com