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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0E8EA7FBFE for ; Fri, 23 Jan 2015 15:03:30 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of arnaud.spiwack@gmail.com) identity=pra; client-ip=209.85.212.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="arnaud.spiwack@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of arnaud.spiwack@gmail.com designates 209.85.212.182 as permitted sender) identity=mailfrom; client-ip=209.85.212.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="arnaud.spiwack@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wi0-f182.google.com) identity=helo; client-ip=209.85.212.182; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="arnaud.spiwack@gmail.com"; x-sender="postmaster@mail-wi0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEBAC9UwlTRVdS2m2dsb2JhbABag1hYBIJ8s36NaYFfAQmFcYEPB0MBAQEBAREBAQEBAQYLCwkULoQMAQEBAwESER0BLQsBAwELAQUDAgsNDR0CAiEBEgEFAQoSBhMIChCHdgMJCA2gdJBPPjGLLoRiimInAwoVhFABCgEBARgBBQ6NQB2CCYI4OxGBMAWEPwmIPoRfS4QLgUSBFDaKeYI1gXMSI4EVW4M2PTEBAYJBAQEB X-IPAS-Result: AuEBAC9UwlTRVdS2m2dsb2JhbABag1hYBIJ8s36NaYFfAQmFcYEPB0MBAQEBAREBAQEBAQYLCwkULoQMAQEBAwESER0BLQsBAwELAQUDAgsNDR0CAiEBEgEFAQoSBhMIChCHdgMJCA2gdJBPPjGLLoRiimInAwoVhFABCgEBARgBBQ6NQB2CCYI4OxGBMAWEPwmIPoRfS4QLgUSBFDaKeYI1gXMSI4EVW4M2PTEBAYJBAQEB X-IronPort-AV: E=Sophos;i="5.09,454,1418079600"; d="scan'208";a="97475680" Received: from mail-wi0-f182.google.com ([209.85.212.182]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Jan 2015 15:03:17 +0100 Received: by mail-wi0-f182.google.com with SMTP id n3so3002606wiv.3 for ; Fri, 23 Jan 2015 06:03:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=1p8xcpyx3iToTZEPL896sYaPkIlc38gU+vc/7DcEpFc=; b=SkPeQJrWxxRCUxxxPLyxKoSdCStnYYYvl9MbF+6hdMD3t+JiUOZnQEaeTqLFFoQa62 gy2/+m/a5QZdi8SU21KzkMtIG2mviSU1xCWV2tlU8mI+1bGEMewU2VRHAUQ9ItMhkcws qsKKrclpxDIERgEZjHdWmILjqBJz1ORD6YX905+TuF/7iB8dpef9RD7Fh23W68ZTyeRb ZCC3TkDVvhY8aaHj0sHFtv4Wg6Z3c5aZUr020LQCHvqTNoKQuSlF/CBb06K3/4WGo/oE dMDbwPRrc7jd4DaYcL4ryD/8cYiGO8q08Fv1Jx8WhysxENuos8PLG3cBAEyi40ilRncB fRdw== X-Received: by 10.180.206.147 with SMTP id lo19mr3955781wic.32.1422021796729; Fri, 23 Jan 2015 06:03:16 -0800 (PST) MIME-Version: 1.0 Sender: arnaud.spiwack@gmail.com Received: by 10.217.180.9 with HTTP; Fri, 23 Jan 2015 06:02:36 -0800 (PST) In-Reply-To: References: <20150108133111.GA3745@pl-59055.rocqadm.inria.fr> <54AE8A9C.5090304@glondu.net> <20150108153342.GB4890@frosties> <171D9BA6-40AA-4B44-BA06-24AE4A156715@gmail.com> From: Arnaud Spiwack Date: Fri, 23 Jan 2015 15:02:36 +0100 X-Google-Sender-Auth: 9ihJEZYOhqacUEf4qsYJL0I4le8 Message-ID: To: yoann padioleau Cc: caml users Content-Type: multipart/alternative; boundary=001a11c37e2e0e9a65050d5240fb X-Validation-by: arnaud@spiwack.net Subject: Re: [Caml-list] Detecting dead code, discovering a project's structure... --001a11c37e2e0e9a65050d5240fb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm confused. I've got a version of pfff compiled from today's github version. I get the following: $ codegraph -lang cmt -build . Fatal error: exception Failure("language not supported: cmt") On 22 January 2015 at 22:09, yoann padioleau wrote: > 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. > 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 -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: > > Dear Yoann, > > Could you give the relevant commands to be used in an ocaml project (in > particular, it seems that `scheck -lang ml` fails with "unsuported > language") ? > > 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 >> -bin_annot) and generates >> an index of a codebase (a graph_code.marshall 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. >> >> >> https://github.com/facebook/pfff/wiki/CodeGraph >> https://github.com/facebook/pfff/wiki/Scheck >> >> >> On Jan 8, 2015, at 7:50 AM, Ashish Agarwal wrote: >> >> Maybe Pfff: >> https://github.com/facebook/pfff >> >> 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 >>> 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 get >>> 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 >>> Goswin >>> >>> -- >>> 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 >>> >> >> >> > > --001a11c37e2e0e9a65050d5240fb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I'm confused. I've got a version of pfff compiled = from today's github version. I get the following:

$ codegraph -l= ang cmt -build .
Fatal error: exception Failure("language not suppo= rted: cmt")


On 22 January 2015 at 22:09, yoann padioleau <aryx.padat= or@gmail.com> wrote:
Hi Arnaud,

You first need = to build the graph code database.
But for that you need to have t= he .cmt files generated for =C2=A0your 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
=C2=A0~/pfff/codegraph -lang cmt -build /path/to/your/pr= oject

then you can use
=C2=A0~/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 particular, it seems that `scheck -lang ml` f= ails with "unsuported language") ?

On 15 January 2015 at 19:16, yoann pad= ioleau <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.marshall file).
Not all features of O= caml are supported though (e.g. functors).

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


https://github.com/facebook/pfff/wiki/Scheck


On Jan 8, 2015, at 7:50 AM, Ashish A= garwal <agarw= al1975@gmail.com> wrote:


On Thu, Jan 8, 2015 at 10:3= 3 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,=C2=A0 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
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Goswin

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://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



--001a11c37e2e0e9a65050d5240fb--