packages feed

SourceGraph 0.1 → 0.2

raw patch · 6 files changed

+49/−20 lines, 6 filesdep ~Cabaldep ~Graphalyzedep ~haskell-src-exts

Dependency ranges changed: Cabal, Graphalyze, haskell-src-exts

Files

Analyse/Utils.hs view
@@ -46,13 +46,13 @@ toGraph       :: (Show a) => FilePath -> String -> AGr a -> DocGraph toGraph p t g = (p,Text t,dg)     where-      dg = graphviz t g+      dg = graphviz t g [maximumSize]  toClusters       :: (Show c, ClusterLabel a c) => FilePath -> String                  -> AGr a -> DocGraph toClusters p t g = (p, Text t, dg)     where-      dg = graphvizClusters t g+      dg = graphvizClusters t g [maximumSize]  -- | Cyclomatic complexity cyclomaticComplexity    :: GraphData a -> Int
Main.hs view
@@ -40,6 +40,7 @@ import Distribution.PackageDescription hiding (author) import Distribution.Verbosity +import Data.Char import Data.List import Data.Maybe import System.IO@@ -73,7 +74,7 @@ programName = "SourceGraph"  programVersion :: String-programVersion = "0.1"+programVersion = "0.2"  putErrLn :: String -> IO () putErrLn = hPutStrLn stderr@@ -146,9 +147,10 @@ -- | Determine if this is the path of a Haskell file. isHaskellFile   :: FilePath -> Bool isHaskellFile f = (takeExtension f) `elem` haskellExtensions-    where-      haskellExtensions = map (extSeparator :) ["hs","lhs"] +haskellExtensions :: [FilePath]+haskellExtensions = map (extSeparator :) ["hs","lhs"]+ -- | Read in all the files that it can. readFiles :: [FilePath] -> IO [FileContents] readFiles = liftM catMaybes . mapM readFileContents@@ -173,11 +175,22 @@                             then return (x:ts,fs)                             else return (ts,x:fs) --- | Trivial paths are the current directory and the parent directory.-isTrivial      :: FilePath -> Bool-isTrivial "."  = True-isTrivial ".." = True-isTrivial _    = False+-- | Trivial paths are the current directory, the parent directory and+--   such directories+isTrivial          :: FilePath -> Bool+isTrivial "."      = True+isTrivial ".."     = True+isTrivial "_darcs" = True+isTrivial "dist"   = True+isTrivial "Pandoc.hs" = True+isTrivial f | isSetup f = True+isTrivial _        = False++lowerCase :: String -> String+lowerCase = map toLower++isSetup   :: String -> Bool+isSetup f = lowerCase f `elem` (map ("setup" <.>) haskellExtensions)  -- ----------------------------------------------------------------------------- 
Parsing/ParseModule.hs view
@@ -55,7 +55,7 @@ parseModule hm (HsModule _ md exps imp decls) = Hs { moduleName = m                                                    , imports    = imps'                                                    , exports    = exps'-                                                   , functions  = fs+                                                   , functions  = funcs                                                    }     where       m = createModule' md@@ -69,7 +69,6 @@             | otherwise   = defFuncs       mainFunc = F m (nameOf main_name) Nothing       hasMain = elem mainFunc defFuncs-      fs = M.fromList funcs       -- We utilise "Tying-the-knot" here to simultaneously update the       -- lookup map as well as utilise that lookup map.       funcs = functionCalls m fl' decls
Parsing/Types.hs view
@@ -78,7 +78,7 @@                   deriving (Eq, Ord)  instance ClusterLabel ModuleName String where-    cluster (M p _) = fromMaybe "" p+    cluster (M p _) = fromMaybe "Root directory" p     nodelabel (M _ m) = m  -- | The seperator between components of a module.@@ -171,11 +171,11 @@ lookupFunctions    :: FunctionLookup -> [Function] -> [Function] lookupFunctions fl = catMaybes . map (functionLookup fl) -type FunctionCalls = Map Function [Function]+type FunctionCalls = [(Function,[Function])]  -- | Get every function call as a pair. functionEdges :: FunctionCalls -> [(Function,Function)]-functionEdges = concatMap mkEdges . M.assocs+functionEdges = concatMap mkEdges     where       mkEdges (f,fs) = map ((,) f) fs @@ -184,8 +184,8 @@  -- | Gets the functions functionsIn :: FunctionCalls -> [Function]-functionsIn = M.keys+functionsIn = map fst  -- | Combine multiple function calls combineCalls :: [FunctionCalls] -> FunctionCalls-combineCalls = M.unions+combineCalls = concat
SourceGraph.cabal view
@@ -1,5 +1,5 @@ Name:                SourceGraph-Version:             0.1+Version:             0.2 Synopsis:            Use graph-theory to analyse your code Description:         SourceGraph uses the Graphalyze library to analyse                      Cabalized Haskell code.@@ -9,6 +9,7 @@ Copyright:           (c) Ivan Lazar Miljenovic Author:              Ivan Lazar Miljenovic Maintainer:          Ivan.Miljenovic@gmail.com+Extra-Source-Files:  TODO Cabal-Version:       >= 1.2 Build-Type:          Simple Tested-With:         GHC==6.8.3@@ -31,6 +32,6 @@     else        Build-Depends:   base < 3 -    Build-Depends:      fgl, Graphalyze >= 0.3, graphviz >= 2008.9.20,-                        Cabal < 1.5, haskell-src-exts+    Build-Depends:      fgl, Graphalyze >= 0.4, graphviz >= 2008.9.20,+                        Cabal >= 1.4, Cabal < 1.5, haskell-src-exts >= 0.3 }
+ TODO view
@@ -0,0 +1,16 @@+TODO for SourceGraph+====================++* Have a way of showing small graphs in the all-in-one file+  that then link to larger graphs.++* Let users choose output directory++* Let users choose output format++* Have a "just draw the graph" option++* "Smarter" analysis: don't show compressed if its boring, etc.++* Write a README+