From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 1B73C8018B for ; Tue, 4 Jul 2017 16:22:40 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=barkmadley@gmail.com; spf=Pass smtp.mailfrom=barkmadley@gmail.com; spf=None smtp.helo=postmaster@mail-ua0-f169.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of barkmadley@gmail.com) identity=pra; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="barkmadley@gmail.com"; x-sender="barkmadley@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of barkmadley@gmail.com designates 209.85.217.169 as permitted sender) identity=mailfrom; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="barkmadley@gmail.com"; x-sender="barkmadley@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ua0-f169.google.com) identity=helo; client-ip=209.85.217.169; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="barkmadley@gmail.com"; x-sender="postmaster@mail-ua0-f169.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A12e9wRw94XDQTlDXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?2+ITIJqq85mqBkHD//Il1AaPBtSEraocw8Pt8InYEVQa5piAtH1QOLdtbDQizf?= =?us-ascii?q?ssogo7HcSeAlf6JvO5JwYzHcBFSUM3tyrjaRsdF8nxfUDdrWOv5jAOBBr/KRB1?= =?us-ascii?q?JuPoEYLOksi7ze6/9pnRbglSmDaxfa55IQmrownWqsQYm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?q?M35jghBMqZS6KFDqKqhrGalm/vBJxdZkhPDFaBAXbhMYKeVKFfRjiVJ5pEmyYH?= =?us-ascii?q?HZK7QoMl2ADm4AXz0bliJ+bQ9zwwupfq1dwz7OrWw0JhvQdoBtiQhjneB1p/mX?= =?us-ascii?q?kFEnprha0=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BWAABOpFtZhqnZVdFcGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFgEBAQMBAQEJAQEBhAYLgRAHg2iBNohjkEUBAQaBKIJBKoYxjGSCESy?= =?us-ascii?q?FcAKDAwc/GAEBAQEBAQEBAQEBEgEBAQgLCwgoL4IzJIJBAQEBAQIBIx0BGxILA?= =?us-ascii?q?QMBCwYFCw0NHQICIgERAQUBChIGExKKBAEDCAUIEKQJP4wKggQFARyDCAWDXAo?= =?us-ascii?q?ZJwMKVoMvAQEBAQEBBAEBAQEBAQEBGAIGEoMVgwWFTIRGUYJmgmEFh3YMjyeHX?= =?us-ascii?q?YdHjD6CYo88k2sUH4EVDxCBQjEhI14ahEAqH4IELjaGa4I/AQEB?= X-IPAS-Result: =?us-ascii?q?A0BWAABOpFtZhqnZVdFcGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBhAYLgRAHg2iBNohjkEUBAQaBKIJBKoYxjGSCESyFcAKDAwc/GAEBA?= =?us-ascii?q?QEBAQEBAQEBEgEBAQgLCwgoL4IzJIJBAQEBAQIBIx0BGxILAQMBCwYFCw0NHQI?= =?us-ascii?q?CIgERAQUBChIGExKKBAEDCAUIEKQJP4wKggQFARyDCAWDXAoZJwMKVoMvAQEBA?= =?us-ascii?q?QEBBAEBAQEBAQEBGAIGEoMVgwWFTIRGUYJmgmEFh3YMjyeHXYdHjD6CYo88k2s?= =?us-ascii?q?UH4EVDxCBQjEhI14ahEAqH4IELjaGa4I/AQEB?= X-IronPort-AV: E=Sophos;i="5.40,307,1496095200"; d="scan'208,217";a="282000142" Received: from mail-ua0-f169.google.com ([209.85.217.169]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 04 Jul 2017 16:22:10 +0200 Received: by mail-ua0-f169.google.com with SMTP id j53so127557446uaa.2 for ; Tue, 04 Jul 2017 07:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0e4SIA5r8MSOt3bCTs1u4Y3p6qWwd1phyXBEFKPVR+Q=; b=AlLjRd+V5X90tZ/KSoYWkvJt8eFLsezQTPUZRLCRVmwygPcZmktBbDlv7h4G86slmG VAG8B9slrRCsvREGAOroJjIN0nnwEJl/40J1Vx5E6v2hD2IIb/RHXVEbNW9xV/4TMQ5+ wnRiyXBDrsJLiJsxNBxV0knayNC2QOxxKDcWFDVQy1YukU4QVHIoeGxC79qzslEELhmO +e8Z0zHYoAja6zqPQzpR4lTfKFIDE28uGV8zwzurHQYrHxM7Rxsx/EVzzSh1V7knFIpl gw/0O59IGNNVvchnCzOpgBN+te90UvjQIBet3AJEOJreJoiLIJ/Nq9NBb60WDcLWdkpU dPAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0e4SIA5r8MSOt3bCTs1u4Y3p6qWwd1phyXBEFKPVR+Q=; b=Opdf3eke4pWLphAPHEsuuAky2SqeUXMm8J+XXJucxvv0/nNUCZUIaBIwLro4kiShH7 GI+HSOzJMn7RLAkNQbZaiL2ncdZwF/Y+XcV0MgxGC5LqyNJeh7cH0Vlnactro6tcbqCv PZhPOr9078arz64UIXLbEPHctuVKUMQTjoTnQlB/+LAHhAVhdyaGRN/D2kVB9Do32YUP DNYqH6H6Z4PCO7Meebn1WacAGa+m/JeSSD9BKiBCA/1YhqHhD5Mt/p0+br7MdlTrZROS mpuirpuFcvemVMN/5ejq5k2Ycu4OkNZmvwLtIBj/gOnz1nHcieqPZCL3jcNLb/Uga1Ye SaDw== X-Gm-Message-State: AKS2vOySHAARsfyVxDLEgzy3snv31RjM8W2y4tVfSEJ36mOXoAGx2sZt tgBc9ATDdOsqqto6DMYcyC+/RSz6dYwx X-Received: by 10.159.34.87 with SMTP id 81mr25047262uad.86.1499178129696; Tue, 04 Jul 2017 07:22:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.87.82 with HTTP; Tue, 4 Jul 2017 07:21:49 -0700 (PDT) In-Reply-To: <20170704140334.GB18152@annexia.org> References: <20170704140128.GA18152@annexia.org> <20170704140334.GB18152@annexia.org> From: Mark Bradley Date: Wed, 5 Jul 2017 00:21:49 +1000 Message-ID: To: "Richard W.M. Jones" Cc: caml-list@inria.fr Content-Type: multipart/alternative; boundary="001a113d778ee02ef505537e9b53" Subject: Re: [Caml-list] OCaml code style and syntax checking --001a113d778ee02ef505537e9b53 Content-Type: text/plain; charset="UTF-8" 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 --001a113d778ee02ef505537e9b53 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Another idea that will get you pa= rt 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 red= uces parentheses where it can
3. it automatically converts begin a= nd end to parentheses.

The 4th criteria could potentially be c= aught using grep.

It's worth an experiment = to see if you like the style of code generated by refmt for OCaml. It certa= inly does a better job at formatting reason code from my limited experiment= s (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 versio= n 1.13.5 as of writing).


On 5 July 2017 at 00:03, Richar= d W.M. Jones <rich@annexia.org> wrote:
On Tue, Jul 04, 2017 at 03:01:28PM +0100, Ri= chard W.M. Jones wrote:
> I have a need to make automated stylistic and syntax checks to
> a large amount of OCaml code.=C2=A0 The sort of rules would be:
>
>=C2=A0 - Check that indentation is used, and used consistently.
>
>=C2=A0 - Excessive use of parentheses where not needed.
>
>=C2=A0 - Use ( .. ) instead of begin .. end.
>
>=C2=A0 - Flag uses of various Obj.* and unsafe_* functions.
>
> It seems to me that some of these could be tested with either camlp4 > or ppx.=C2=A0 I think if we allowed the checker to go back to the orig= inal
> code (eg to see if the parser parsed as block as '(' or 'b= egin'),
> 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.=C2=A0 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
--001a113d778ee02ef505537e9b53--