[Haskell-cafe] Re: [Haskell] ANNOUNCE: Graphalyze-0.4 and SourceGraph-0.2

Gwern Branwen gwern0 at gmail.com
Sun Oct 12 13:24:40 EDT 2008


On 2008.10.12 23:54:44 +1000, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> scribbled 6.4K characters:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'd like to announce version 0.4 of my Graphalyze library [1] and 0.2 of my
> SourceGraph programme [2].
>
> [1] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/Graphalyze
> [2] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/SourceGraph
>
> This should fix the bugs reported by Gwern Branwen, Magnus Therning (thanks to
> Niklas Broberg for stating the correct version for Haskell-Src-Exts) and
> Christopher Hinson.  No really new features are included in this release.  I
> was planning on fixing this and releasing it sooner but - to utilise what seems
> to be a current meme [3] - "I accidentally my Gentoo" on Tuesday night and only
> fixed it yesterday.
>
> [3] http://encyclopediadramatica.com/I_accidentally_X
>
> Since I'm more awake now than I was when I made the initial release, here's a
> run-down of what SourceGraph is:
>
> SourceGraph is a programme designed to help you analyse the static complexity
> of your Haskell code when represented as a graph.  At the moment, it does the
> following (M == for each module, I = for imports, C = the whole codebase):
>
> * Visualise it {M,I,C}
> * See a "collapsed" visualisation {M}
> * Proposed module/directory layout using two different algorithms {I,C}
> * See the "core" visualisation (recursively strip off roots/leaves) {M}
> * Calculate the Cyclomatic complexity [4] {M,I,C}
> * Root analysis (compare what's exported to what actually is a root) {M,I,C}
> * Determine how many components you have, to see if you should split {M,I,C}
> * Clique Analysis (find co-recursive functions) {M,C}
> * Cycle analysis (non-cliques) {M,I,C}
> * Chain detection (e.g. "straight-line" functions/imports) {M,I,C}
>
> [4] http://en.wikipedia.org/wiki/Cyclomatic_complexity
>
> Current limitations:
>
> * An automatic  refactoring tool: SourceGraph gives *you* information on how you
>   might want to possibly refactor your code.  It's not smart: it can't tell
>   that you've clumped functions foo and bar in the same module because they do
>   similar things or because it's a utility module, even though they're not
>   related.  For automatic refactoring, see something like HaRe [5].
> * SourceGraph ignore's "data-based" functions, i.e. record-functions and
>   class/instance declarations, as it's too confusing (IMHO) which actual
>   function you mean (if you see "show" being called, is it for Int, Double, or
>   something else?).
> * Despite using Haskell-Src-Exts, some extensions (e.g. TH) are ignored, mainly
>   because I have no idea how they work and nothing to test it on.  GHC
>   extensions should be supported (read the parser won't choke on them) though.
> * Reporting output is currently rather limited:
>   - The report will be generated in a subdirectory called "SourceGraph" of the
>     codebase directory; this is currently hardwired in.
>   - It will produce an all-in-one html file report, with no fancy CSS magic to
>     make it look pretty.  Ideally, it would produce a split-file, and allow you
>     to choose output format.
>   - Large graphs are shrunk down to being a maximum of 15"x10".  Ideally, I'd
>     like to extend this later so that large graphs will have a shrunk version
>     in the graph, which link to a larger version (note though that these graphs
>     get very large very fast).
>   - The output of individual function names, etc. could be improved.
>
> [5] http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
>
> SourceGraph can be installed with cabal-install.  Once you've done so, you can
> analyse a cabalized library/application Foo as follows:
>
>     $ SourceGraph /path/to/codebase/Foo.cabal
>     Report generated at: /path/to/codebase/SourceGraph/Foo.html
>
> This has been written as part of my mathematics Honours Thesis,
> "Graph-Theoretic Analysis of the Relationships in Discrete Data".  Since I've
> actually got to write the thesis up now, I won't be making any more releases
> for a while.  After uni is over for the semester though, I hope to tidy it up
> and extend it.
>
> If you want to check the code out yourselves, there's also darcs repositories
> for Graphalyze [6] and SourceGraph [7].
>
> [6] http://code.haskell.org/Graphalyze
> [7] http://code.haskell.org/SourceGraph/
>
> Note that whilst Graphalyze is fully documented, etc., the internals of
> SourceGraph are a bit fugly (mainly due to time constraints).
>
> Enjoy!
>
> - --
> Ivan Lazar Miljenovic

OK, I've installed and yes - it now produces output for XMC instead of looping.

However, I happened to want to look at the output for one of my modules, XMonad.Util.XSelection - and it simply isn't there. Most of the XMC modules seem to be there, but that one isn't. It's in the cabal file, SourceGraph did not output any errors or warnings, but XSelection is not mentioned in the HTML output nor are any PNGs generated with regard to it. See:

gwern at craft:24375~/bin/XMonadContrib/SourceGraph>grep XSelection ../xmonad-contrib.cabal        [ 1:20PM]
                        XMonad.Util.XSelection
gwern at craft:24372~/bin/XMonadContrib>SourceGraph xmonad-contrib.cabal [ 1:16PM]
Report generated at: SourceGraph/xmonad-contrib.html
SourceGraph xmonad-contrib.cabal  59.05s user 4.14s system 98% cpu 1:03.83 total
gwern at craft:24373~/bin/XMonadContrib>c SourceGraph [ 1:17PM]
codeCluster.png XMonad.Layout.DragPane_collapsed.png
codeCollapsed.png                                  XMonad.Layout.DragPane.png
codeCore.png XMonad.Layout.DwmStyle_collapsed.png
codeCW.png                                         XMonad.Layout.DwmStyle.png
code.png XMonad.Layout.Gaps_collapsed.png
codeRNG.png                                        XMonad.Layout.Gaps.png
importCluster.png XMonad.Layout.Grid_collapsed.png
importCW.png                                       XMonad.Layout.Grid.png
importRNG.png XMonad.Layout.HintedGrid_collapsed.png
imports.png                                        XMonad.Layout.HintedGrid.png
Main_collapsed.png XMonad.Layout.HintedTile_collapsed.png
Main.png XMonad.Layout.HintedTile_core.png
XMonad.Actions.Commands_collapsed.png              XMonad.Layout.HintedTile.png
XMonad.Actions.Commands.png XMonad.Layout.IM_collapsed.png
XMonad.Actions.ConstrainedResize_collapsed.png     XMonad.Layout.IM.png
XMonad.Actions.ConstrainedResize.png XMonad.Layout.LayoutCombinators_collapsed.png
XMonad.Actions.CopyWindow_collapsed.png XMonad.Layout.LayoutCombinators.png
XMonad.Actions.CopyWindow.png XMonad.Layout.LayoutHints_collapsed.png
XMonad.Actions.CycleRecentWS_collapsed.png         XMonad.Layout.LayoutHints.png
XMonad.Actions.CycleRecentWS.png XMonad.Layout.LayoutModifier_collapsed.png
XMonad.Actions.CycleSelectedLayouts_collapsed.png XMonad.Layout.LayoutModifier.png
XMonad.Actions.CycleSelectedLayouts.png XMonad.Layout.LayoutScreens_collapsed.png
XMonad.Actions.CycleWS_collapsed.png XMonad.Layout.LayoutScreens.png
XMonad.Actions.CycleWS_core.png XMonad.Layout.MagicFocus_collapsed.png
XMonad.Actions.CycleWS.png                         XMonad.Layout.MagicFocus.png
XMonad.Actions.DeManage_collapsed.png XMonad.Layout.Magnifier_collapsed.png
XMonad.Actions.DeManage.png                        XMonad.Layout.Magnifier.png
XMonad.Actions.DwmPromote_collapsed.png XMonad.Layout.Master_collapsed.png
XMonad.Actions.DwmPromote.png                      XMonad.Layout.Master.png
XMonad.Actions.DynamicWorkspaces_collapsed.png XMonad.Layout.Maximize_collapsed.png
XMonad.Actions.DynamicWorkspaces.png               XMonad.Layout.Maximize.png
XMonad.Actions.FindEmptyWorkspace_collapsed.png XMonad.Layout.MosaicAlt_collapsed.png
XMonad.Actions.FindEmptyWorkspace.png XMonad.Layout.MosaicAlt_core.png
XMonad.Actions.FlexibleManipulate_collapsed.png    XMonad.Layout.MosaicAlt.png
XMonad.Actions.FlexibleManipulate.png XMonad.Layout.MultiToggle_collapsed.png
XMonad.Actions.FlexibleResize_collapsed.png XMonad.Layout.MultiToggle.Instances_collapsed.png
XMonad.Actions.FlexibleResize.png XMonad.Layout.MultiToggle.Instances.png
XMonad.Actions.FloatKeys_collapsed.png             XMonad.Layout.MultiToggle.png
XMonad.Actions.FloatKeys.png XMonad.Layout.Named_collapsed.png
XMonad.Actions.FocusNth_collapsed.png              XMonad.Layout.Named.png
XMonad.Actions.FocusNth.png XMonad.Layout.NoBorders_collapsed.png
XMonad.Actions.MouseGestures_collapsed.png         XMonad.Layout.NoBorders.png
XMonad.Actions.MouseGestures.png XMonad.Layout.PerWorkspace_collapsed.png
XMonad.Actions.MouseResize_collapsed.png XMonad.Layout.PerWorkspace.png
XMonad.Actions.MouseResize.png XMonad.Layout.Reflect_collapsed.png
XMonad.Actions.NoBorders_collapsed.png             XMonad.Layout.Reflect.png
XMonad.Actions.NoBorders.png XMonad.Layout.ResizeScreen_collapsed.png
XMonad.Actions.PerWorkspaceKeys_collapsed.png XMonad.Layout.ResizeScreen.png
XMonad.Actions.PerWorkspaceKeys.png XMonad.Layout.Roledex_collapsed.png
XMonad.Actions.Plane_collapsed.png                 XMonad.Layout.Roledex.png
XMonad.Actions.Plane.png XMonad.Layout.ShowWName_collapsed.png
XMonad.Actions.Promote_collapsed.png               XMonad.Layout.ShowWName.png
XMonad.Actions.Promote.png XMonad.Layout.SimpleDecoration_collapsed.png
XMonad.Actions.RotSlaves_collapsed.png XMonad.Layout.SimpleDecoration.png
XMonad.Actions.RotSlaves.png XMonad.Layout.SimpleFloat_collapsed.png
XMonad.Actions.Search_collapsed.png                XMonad.Layout.SimpleFloat.png
XMonad.Actions.Search.png XMonad.Layout.Simplest_collapsed.png
XMonad.Actions.SimpleDate_collapsed.png XMonad.Layout.SimplestFloat_collapsed.png
XMonad.Actions.SimpleDate.png XMonad.Layout.SimplestFloat.png
XMonad.Actions.SinkAll_collapsed.png               XMonad.Layout.Simplest.png
XMonad.Actions.SinkAll.png XMonad.Layout.Spiral_collapsed.png
XMonad.Actions.Submap_collapsed.png                XMonad.Layout.Spiral_core.png
XMonad.Actions.Submap.png                          XMonad.Layout.Spiral.png
XMonad.Actions.SwapWorkspaces_collapsed.png XMonad.Layout.Square_collapsed.png
XMonad.Actions.SwapWorkspaces.png                  XMonad.Layout.Square.png
XMonad.Actions.TagWindows_collapsed.png XMonad.Layout.TabBarDecoration_collapsed.png
XMonad.Actions.TagWindows.png XMonad.Layout.TabBarDecoration.png
XMonad.Actions.UpdatePointer_collapsed.png XMonad.Layout.Tabbed_collapsed.png
XMonad.Actions.UpdatePointer.png                   XMonad.Layout.Tabbed.png
XMonad.Actions.Warp_collapsed.png XMonad.Layout.ToggleLayouts_collapsed.png
XMonad.Actions.Warp.png XMonad.Layout.ToggleLayouts.png
XMonad.Actions.WindowBringer_collapsed.png XMonad.Layout.TwoPane_collapsed.png
XMonad.Actions.WindowBringer.png                   XMonad.Layout.TwoPane.png
XMonad.Actions.WindowGo_collapsed.png XMonad.Layout.WindowArranger_collapsed.png
XMonad.Actions.WindowGo.png XMonad.Layout.WindowArranger.png
XMonad.Actions.WindowNavigation_collapsed.png XMonad.Layout.WindowNavigation_collapsed.png
XMonad.Actions.WindowNavigation_core.png XMonad.Layout.WindowNavigation_core.png
XMonad.Actions.WindowNavigation.png XMonad.Layout.WindowNavigation.png
XMonad.Config.Arossato_collapsed.png XMonad.Layout.WorkspaceDir_collapsed.png
XMonad.Config.Arossato.png XMonad.Layout.WorkspaceDir.png
XMonad.Config.Azerty_collapsed.png XMonad.Prompt.AppendFile_collapsed.png
XMonad.Config.Azerty.png                           XMonad.Prompt.AppendFile.png
XMonad.Config.Desktop_collapsed.png XMonad.Prompt.AppLauncher_collapsed.png
XMonad.Config.Desktop.png                          XMonad.Prompt.AppLauncher.png
XMonad.Config.Droundy_collapsed.png                XMonad.Prompt_collapsed.png
XMonad.Config.Droundy.png                          XMonad.Prompt_core.png
XMonad.Config.Gnome_collapsed.png XMonad.Prompt.Directory_collapsed.png
XMonad.Config.Gnome.png                            XMonad.Prompt.Directory.png
XMonad.Config.Kde_collapsed.png XMonad.Prompt.DirExec_collapsed.png
XMonad.Config.Kde.png                              XMonad.Prompt.DirExec.png
XMonad.Config.PlainConfig_collapsed.png XMonad.Prompt.Email_collapsed.png
XMonad.Config.PlainConfig_core.png                 XMonad.Prompt.Email.png
XMonad.Config.PlainConfig.png XMonad.Prompt.Input_collapsed.png
XMonad.Config.Sjanssen_collapsed.png               XMonad.Prompt.Input.png
XMonad.Config.Sjanssen.png XMonad.Prompt.Layout_collapsed.png
XMonad.Config.Xfce_collapsed.png                   XMonad.Prompt.Layout.png
XMonad.Config.Xfce.png XMonad.Prompt.Man_collapsed.png
xmonad-contrib.html                                XMonad.Prompt.Man.png
XMonad.Doc_collapsed.png                           XMonad.Prompt.png
XMonad.Doc.Configuring_collapsed.png XMonad.Prompt.RunOrRaise_collapsed.png
XMonad.Doc.Configuring.png                         XMonad.Prompt.RunOrRaise.png
XMonad.Doc.Developing_collapsed.png XMonad.Prompt.Shell_collapsed.png
XMonad.Doc.Developing.png                          XMonad.Prompt.Shell_core.png
XMonad.Doc.Extending_collapsed.png                 XMonad.Prompt.Shell.png
XMonad.Doc.Extending.png XMonad.Prompt.Ssh_collapsed.png
XMonad.Doc.png                                     XMonad.Prompt.Ssh.png
XMonad.Hooks.DynamicHooks_collapsed.png XMonad.Prompt.Theme_collapsed.png
XMonad.Hooks.DynamicHooks.png                      XMonad.Prompt.Theme.png
XMonad.Hooks.DynamicLog_collapsed.png XMonad.Prompt.Window_collapsed.png
XMonad.Hooks.DynamicLog.png                        XMonad.Prompt.Window.png
XMonad.Hooks.EventHook_collapsed.png XMonad.Prompt.Workspace_collapsed.png
XMonad.Hooks.EventHook.png                         XMonad.Prompt.Workspace.png
XMonad.Hooks.EwmhDesktops_collapsed.png XMonad.Prompt.XMonad_collapsed.png
XMonad.Hooks.EwmhDesktops.png                      XMonad.Prompt.XMonad.png
XMonad.Hooks.FadeInactive_collapsed.png XMonad.Util.CustomKeys_collapsed.png
XMonad.Hooks.FadeInactive.png                      XMonad.Util.CustomKeys.png
XMonad.Hooks.ManageDocks_collapsed.png XMonad.Util.Dmenu_collapsed.png
XMonad.Hooks.ManageDocks.png                       XMonad.Util.Dmenu.png
XMonad.Hooks.ManageHelpers_collapsed.png XMonad.Util.Dzen_collapsed.png
XMonad.Hooks.ManageHelpers.png                     XMonad.Util.Dzen.png
XMonad.Hooks.Script_collapsed.png XMonad.Util.EZConfig_collapsed.png
XMonad.Hooks.Script.png                            XMonad.Util.EZConfig.png
XMonad.Hooks.ServerMode_collapsed.png XMonad.Util.Invisible_collapsed.png
XMonad.Hooks.ServerMode.png                        XMonad.Util.Invisible.png
XMonad.Hooks.SetWMName_collapsed.png XMonad.Util.Loggers_collapsed.png
XMonad.Hooks.SetWMName.png                         XMonad.Util.Loggers.png
XMonad.Hooks.UrgencyHook_collapsed.png XMonad.Util.NamedWindows_collapsed.png
XMonad.Hooks.UrgencyHook.png                       XMonad.Util.NamedWindows.png
XMonad.Hooks.XPropManage_collapsed.png XMonad.Util.Paste_collapsed.png
XMonad.Hooks.XPropManage.png                       XMonad.Util.Paste.png
XMonad.Layout.Accordion_collapsed.png              XMonad.Util.Run_collapsed.png
XMonad.Layout.Accordion.png                        XMonad.Util.Run.png
XMonad.Layout.BoringWindows_collapsed.png XMonad.Util.Scratchpad_collapsed.png
XMonad.Layout.BoringWindows.png                    XMonad.Util.Scratchpad.png
XMonad.Layout.Circle_collapsed.png XMonad.Util.Themes_collapsed.png
XMonad.Layout.Circle.png                           XMonad.Util.Themes.png
XMonad.Layout.Combo_collapsed.png XMonad.Util.Timer_collapsed.png
XMonad.Layout.Combo.png                            XMonad.Util.Timer.png
XMonad.Layout.Decoration_collapsed.png XMonad.Util.WindowProperties_collapsed.png
XMonad.Layout.Decoration_core.png XMonad.Util.WindowProperties_core.png
XMonad.Layout.DecorationMadness_collapsed.png XMonad.Util.WindowProperties.png
XMonad.Layout.DecorationMadness.png XMonad.Util.WorkspaceCompare_collapsed.png
XMonad.Layout.Decoration.png XMonad.Util.WorkspaceCompare.png
XMonad.Layout.Dishes_collapsed.png XMonad.Util.XUtils_collapsed.png
XMonad.Layout.Dishes.png                           XMonad.Util.XUtils.png

gwern at craft:24374~/bin/XMonadContrib/SourceGraph>grep XSelection * [ 1:19PM]
gwern at craft:24375~/bin/XMonadContrib/SourceGraph>

(I'd attach the output, but even a gzipped tarball of SourceGraph/ is 8.2M, and someone complained about the last one which was only a few megabytes, so...)

--
gwern
SLBM TRW NSS 32 Poseidon blackjack global Aum enforcers Unit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20081012/51a7a931/attachment.bin


More information about the Haskell-Cafe mailing list