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 2C4927FBFE for ; Thu, 22 Jan 2015 22:09:38 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of aryx.padator@gmail.com) identity=pra; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="aryx.padator@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of aryx.padator@gmail.com designates 209.85.220.48 as permitted sender) identity=mailfrom; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="aryx.padator@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-pa0-f48.google.com) identity=helo; client-ip=209.85.220.48; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="aryx.padator@gmail.com"; x-sender="postmaster@mail-pa0-f48.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AscBAHVmwVTRVdwwlGdsb2JhbABagmR0WIMEsHYBBoJ1jWmBXwEJhXECgRhDAQEBAQERAQEBAQcLCwkSMIQMAQEBAwESER0BGxILAQMBCwYFCwMKDRoDAgIhAhEBBQEKAREGExIQh3UBAwkIAQQIsjw+MYsugWuCd4o4ChknAwoVP4QRAQEBAQEBAQEBAQEBAQEBAQEBAQEBEQEFDoV3h0odggkEB4ItOxEdgRMFhD8JhTiDBoRfS4QLgUSBFDaKeYI1gXM1gRWEMU4BAYJBAQEB X-IPAS-Result: AscBAHVmwVTRVdwwlGdsb2JhbABagmR0WIMEsHYBBoJ1jWmBXwEJhXECgRhDAQEBAQERAQEBAQcLCwkSMIQMAQEBAwESER0BGxILAQMBCwYFCwMKDRoDAgIhAhEBBQEKAREGExIQh3UBAwkIAQQIsjw+MYsugWuCd4o4ChknAwoVP4QRAQEBAQEBAQEBAQEBAQEBAQEBAQEBEQEFDoV3h0odggkEB4ItOxEdgRMFhD8JhTiDBoRfS4QLgUSBFDaKeYI1gXM1gRWEMU4BAYJBAQEB X-IronPort-AV: E=Sophos;i="5.09,451,1418079600"; d="scan'208,217";a="118227181" Received: from mail-pa0-f48.google.com ([209.85.220.48]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Jan 2015 22:09:36 +0100 Received: by mail-pa0-f48.google.com with SMTP id ey11so4237084pad.7 for ; Thu, 22 Jan 2015 13:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=bc+7e07Qpng3l1EVly0jdUz0PLRws3vjm/ENLitaIcU=; b=HF+vlsCZEaXKUpavD+LIHVNLqK7B7eat5YhFbFLbAx4uIvqMuXpeliHyfBcB61bGMr zu3PSN1Deg6vrTwJhUEMgKL7IREmlS+VB+t5ImTL3jFGUkImCmsFur/w9Hp2c6j5Vt2m /iAdjrMrXn8kDBj9XEnB8zxuT9OHtOY2wNnYUgPJAKnYpOmLmbqTBvMmi14YiUZyB5wV 4IHJLn4D2n53DgHcoDLm9eS1NgyyDO1Hx/kD83j8bXm/TIe5XnwztPz5cB+Aqh4OwMas 0w6mi5bjddpbVX8SDc/4gzXVIfOXq8QbRXcOgTivESqCCb1xxSrSf/PqClLOD2o3GNy6 BS2Q== X-Received: by 10.66.63.106 with SMTP id f10mr5806534pas.0.1421960974733; Thu, 22 Jan 2015 13:09:34 -0800 (PST) Received: from ?IPv6:2601:9:5780:18d2:d7f:34a4:6859:a9c? ([2601:9:5780:18d2:d7f:34a4:6859:a9c]) by mx.google.com with ESMTPSA id xq16sm10175646pac.31.2015.01.22.13.09.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Jan 2015 13:09:33 -0800 (PST) Content-Type: multipart/alternative; boundary="Apple-Mail=_4F655A55-B94C-4686-8FD4-11C13DE7F1BB" Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) From: yoann padioleau In-Reply-To: Date: Thu, 22 Jan 2015 13:09:30 -0800 Cc: Ashish Agarwal , Goswin von Brederlow , caml users Message-Id: References: <20150108133111.GA3745@pl-59055.rocqadm.inria.fr> <54AE8A9C.5090304@glondu.net> <20150108153342.GB4890@frosties> <171D9BA6-40AA-4B44-BA06-24AE4A156715@gmail.com> To: Arnaud Spiwack X-Mailer: Apple Mail (2.1993) Subject: Re: [Caml-list] Detecting dead code, discovering a project's structure... --Apple-Mail=_4F655A55-B94C-4686-8FD4-11C13DE7F1BB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Arnaud, You first need to build the graph code database. But for that you need to have the .cmt files generated for your project. Y= ou can generate them just like you generate the .annot by modifying your ma= kefile, e.g. by adding -bin_annot to OCAMLCFLAGS for instance. Once the .cmt are here, do ~/pfff/codegraph -lang cmt -build /path/to/your/project then you can use ~/pfff/scheck -lang cmt /path/to/your/project > On Jan 19, 2015, at 1:58 AM, Arnaud Spiwack wrote: >=20 > Dear Yoann, >=20 > Could you give the relevant commands to be used in an ocaml project (in p= articular, it seems that `scheck -lang ml` fails with "unsuported language"= ) ? >=20 > On 15 January 2015 at 19:16, yoann padioleau > wrote: > Indeed the codegraph tool, part of Pfff, does some > global analysis of an ocaml project using the .Mt (generated by ocamlc -b= in_annot) and generates > an index of a codebase (a graph_code.marshall file). > Not all features of Ocaml are supported though (e.g. functors). >=20 > Once the graph_code.marshall file has been generated, > you can use check, also part of pfff, to detect dead code > or other errors. >=20 >=20 > https://github.com/facebook/pfff/wiki/CodeGraph > https://github.com/facebook/pfff/wiki/Scheck >=20 >=20 > On Jan 8, 2015, at 7:50 AM, Ashish Agarwal > wrote: >=20 >> Maybe Pfff: >> https://github.com/facebook/pfff >>=20 >> On Thu, Jan 8, 2015 at 10:33 AM, Goswin von Brederlow > wrote: >> On Thu, Jan 08, 2015 at 02:48:12PM +0100, St=C3=A9phane Glondu wrote: >> > Le 08/01/2015 14:31, S=C3=A9bastien Hinderer a =C3=A9crit : >> > > Are there tools / techniques one could use to make it easier to >> > > discover / explore the source code of a big OCaml project? >> > > >> > > In particular, are there any tools available to help finding dead c= ode >> > > or coe that may need some refactoring? >> > > >> > > Many thanks for any suggestion. >> > >> > One suggestion: http://home.gna.org/oug/index.fr.html >> > >> > >> > Cheers, >>=20 >> That looks cool. But that still needs a lot of manual filtering to get >> results, e.g. to find an unused type or function specified in the >> input signature for a functor. >>=20 >> It could be nice for ocaml to have warnings for this directly. E.g.: >>=20 >> module type M =3D ssig type t type s val x : int end >> moduel F(M : M) =3D struct type t =3D M.t end >>=20 >> Warning: unused value x in signature M for functor F >> Warning: unused type s in signature M for functor F >>=20 >> Similar for types / values defined but not used in .ml files that do >> not appear in the .mli file. >>=20 >> MfG >> Goswin >>=20 >> -- >> 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 >>=20 >=20 >=20 --Apple-Mail=_4F655A55-B94C-4686-8FD4-11C13DE7F1BB Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi Arnaud,

You first need to build the gr= aph code database.
But for that you need to have the .= cmt files generated for  your project. You can generate them just like= you generate the .annot by modifying your makefile, e.g.
by adding -bin_annot to OCAMLCFLAGS for instance.
Once the .cmt are here, do
 ~/pfff/codegraph -l= ang cmt -build /path/to/your/project

then you can use
 ~/pfff/sche= ck -lang cmt /path/to/your/project


=
On Jan 19, 2015, at 1:58 AM, Arnaud Spiwack <aspiwack@lix.polytechnique= .fr> wrote:

Dear Yoann,

= Could you give the relevant commands to be used in an ocaml project (in par= ticular, it seems that `scheck -lang ml` fails with "unsuported language") = ?

On 15 January 2015 at 19:16, yoann padioleau <aryx.padator@gmail.com> wrote:
=
Indeed the codegraph tool, part of Pfff, does some
global= analysis of an ocaml project using the .Mt (generated by ocamlc -bin_annot= ) and generates
an index of a codebase (a graph_code.m= arshall file).
Not all features of Ocaml are supported= though (e.g. functors).

Once the graph_code.marshall file has been generated,
you can use check, also part of pfff, to detect dead code
or other errors.




On Jan 8, 2015, at 7:50 AM, Ashish Agarwal <= ;agar= wal1975@gmail.com> wrote:


On Thu, Jan 8, 2015 at 1= 0:33 AM, Goswin von Brederlow <goswin-v-b@web.de= > wrote:
On Thu, Jan 08, 2015 at 02:48:12PM +0100, St=C3=A9phane Glondu wrote:=
> Le 08/01/2015 14:31, S=C3=A9bastien Hinderer a =C3=A9crit :
> > Are there tools / techniques one could use to make it easier to > > discover / explore the source code of a big OCaml project?
> >
> > In particular,  are there any tools available to help findin= g dead code
> > or coe that may need some refactoring?
> >
> > Many thanks for any suggestion.
>
> One suggestion: http://home.gna.org/oug/index.fr.html
>
>
> Cheers,

That looks cool. But that still needs a lot of manual filtering to g= et
results, e.g. to find an unused type or function specified in the
input signature for a functor.

It could be nice for ocaml to have warnings for this directly. E.g.:

module type M =3D ssig type t type s val x : int end
moduel F(M : M) =3D struct type t =3D M.t end

Warning: unused value x in signature M for functor F
Warning: unused type s in signature M for functor F

Similar for types / values defined but not used in .ml files that do
not appear in the .mli file.

MfG
      &n= bsp; Goswin




= --Apple-Mail=_4F655A55-B94C-4686-8FD4-11C13DE7F1BB--