SourceGraph 0.5.1.0 → 0.5.2.0
raw patch · 7 files changed
+58/−40 lines, 7 files
Files
- Analyse.hs +2/−2
- Analyse/Utils.hs +26/−25
- ChangeLog +12/−0
- Main.hs +2/−2
- Parsing/Types.hs +10/−10
- SourceGraph.cabal +1/−1
- TODO +5/−0
Analyse.hs view
@@ -43,7 +43,7 @@ -- 'HaskellModules' form. analyse :: (RandomGen g) => g -> [ModName] -> ParsedModules -> [DocElement]-analyse g exps hms = [ analyseModules hms+analyse g exps hms = [ analyseEverything g exps hms , analyseImports exps hms- , analyseEverything g exps hms+ , analyseModules hms ]
Analyse/Utils.hs view
@@ -128,7 +128,7 @@ nAttr callAttributes' where- gAttrs = [NodeAttrs [Margin . PVal $ PointD 0.2 0.2]] -- [GraphAttrs [Label $ StrLabel t]]+ gAttrs = [NodeAttrs [Margin . PVal $ PointD 0.5 0.2]] -- [GraphAttrs [Label $ StrLabel t]] dg' = updateGraph compactSame dg -- Possible clustering problem toClust = clusterEntity -- bool clusterEntity clusterEntityM' $ isJust mm@@ -146,7 +146,7 @@ nAttr callAttributes' where- gAttrs = [] -- [GraphAttrs [Label $ StrLabel t]]+ gAttrs = [NodeAttrs [Margin . PVal $ PointD 0.5 0.2]] -- [GraphAttrs [Label $ StrLabel t]] dg' = updateGraph (compactSame . collapseStructures') dg rs = getRoots dg ls = getLeaves dg@@ -217,24 +217,24 @@ callAttributes' (_,_,(n,ct)) = PenWidth (fromIntegral n) : callAttributes ct -clustAttributes :: EntClustType -> Attributes-clustAttributes (ClassDefn c) = [ Label . StrLabel $ "Class: " ++ c- , Style [SItem Filled [], SItem Rounded []]- , FillColor $ ColorName "rosybrown1"- ]-clustAttributes (DataDefn d) = [ Label . StrLabel $ "Data: " ++ d- , Style [SItem Filled [], SItem Rounded []]- , FillColor $ ColorName "papayawhip"- ]-clustAttributes (ClassInst d) = [ Label . StrLabel $ "Instance for: " ++ d- , Style [SItem Filled [], SItem Rounded []]- , FillColor $ ColorName "slategray1"- ]-clustAttributes DefInst = [ Label . StrLabel $ "Default Instance"+clustAttributes :: EntClustType -> Attributes+clustAttributes (ClassDefn c) = [ Label . StrLabel $ "Class: " ++ c+ , Style [SItem Filled [], SItem Rounded []]+ , FillColor $ ColorName "rosybrown1"+ ]+clustAttributes (DataDefn d) = [ Label . StrLabel $ "Data: " ++ d+ , Style [SItem Filled [], SItem Rounded []]+ , FillColor $ ColorName "papayawhip"+ ]+clustAttributes (ClassInst _ d) = [ Label . StrLabel $ "Instance for: " ++ d , Style [SItem Filled [], SItem Rounded []] , FillColor $ ColorName "slategray1" ]-clustAttributes (ModPath p) = [ Label $ StrLabel p ]+clustAttributes DefInst{} = [ Label . StrLabel $ "Default Instance"+ , Style [SItem Filled [], SItem Rounded []]+ , FillColor $ ColorName "slategray1"+ ]+clustAttributes (ModPath p) = [ Label $ StrLabel p ] clustAttributes' :: EntClustType -> [GlobalAttributes] clustAttributes' = return . GraphAttrs . clustAttributes@@ -257,7 +257,7 @@ nAttr callAttributes' where- gAttrs = [] -- [GraphAttrs [Label $ StrLabel t]]+ gAttrs = [NodeAttrs [Margin . PVal $ PointD 0.5 0.2]] -- [GraphAttrs [Label $ StrLabel t]] cAttr = [GraphAttrs [ Style [SItem Filled []] , FillColor $ ColorName "wheat1" ]@@ -280,23 +280,24 @@ nAttr (const []) where- cID s = bool (Just $ Str s) Nothing $ null s- gAttrs = [] --[GraphAttrs [Label $ StrLabel t]]+ cID s = bool (Just $ Str s) Nothing $ (not . null) s+ gAttrs = [NodeAttrs [Margin . PVal $ PointD 0.5 0.2]] --[GraphAttrs [Label $ StrLabel t]] cAttr p = [GraphAttrs [Label $ StrLabel p]] rs = I.fromList $ applyAlg rootsOf' dg ls = I.fromList $ applyAlg leavesOf' dg es = I.fromList $ wantedRootNodes dg nAttr (n,m) = [ Label $ StrLabel m- , Color [ColorName $ mCol rs ls es n]+ , FillColor $ ColorName $ mCol rs ls es n+ , Style [SItem Filled []] , Shape Tab ] mCol :: IntSet -> IntSet -> IntSet -> Node -> String mCol rs ls es n- | isR && not isE = "red"- | isR = "mediumblue"- | isL = "forestgreen"- | otherwise = "black"+ | isR && not isE = "crimson"+ | isR = "gold"+ | isL = "cyan"+ | otherwise = "bisque" where isR = n `I.member` rs isL = n `I.member` ls
ChangeLog view
@@ -1,3 +1,15 @@+Changes since 0.5.2.0+=====================++* Shift overall analysis to the top and per-module analysis to the+ end, as suggested by Duncan Coutts.++* Graph drawing fixups: instances are now drawn correctly, and the+ module graph now has modules located in the correct directory.++* Improve some graph drawing aspects (node margins, colours for module+ graphs, etc.).+ Changes since 0.5.1.0 =====================
Main.hs view
@@ -271,6 +271,6 @@ , Emphasis $ Text programmeName , Text " is " , Bold $ Text "not"- , Text " a refactoring tool, and does not take into \- \account Class declarations and record functions."+ , Text " a refactoring tool, and it's usage of Classes is\+ \ not yet perfect." ]
Parsing/Types.hs view
@@ -302,23 +302,23 @@ (Constructor d) -> C $ DataDefn d (RecordFunction d) -> C $ DataDefn d (ClassFunction c) -> C $ ClassDefn c- (DefaultInstance c) -> C (ClassDefn c) . C DefInst- (ClassInstance c d) -> C (ClassDefn c) . C (ClassInst d)+ (DefaultInstance c) -> C (ClassDefn c) . C (DefInst c)+ (ClassInstance c d) -> C (ClassDefn c) . C (ClassInst c d) _ -> id data EntClustType = ClassDefn ClassName | DataDefn DataType- | ClassInst DataType- | DefInst+ | ClassInst ClassName DataType+ | DefInst ClassName | ModPath String deriving (Eq, Ord, Show, Read) -ctypeID :: EntClustType -> Maybe GraphID-ctypeID (ClassDefn c) = Just . Str $ "Class_" ++ escID c-ctypeID (DataDefn d) = Just . Str $ "Data_" ++ escID d-ctypeID (ClassInst d) = Just . Str $ "Inst_For_" ++ escID d-ctypeID DefInst = Just . Str $ "DefaultInstance"-ctypeID (ModPath p) = Just . Str $ "Directory_" ++ escID p+ctypeID :: EntClustType -> Maybe GraphID+ctypeID (ClassDefn c) = Just . Str $ "Class_" ++ escID c+ctypeID (DataDefn d) = Just . Str $ "Data_" ++ escID d+ctypeID (ClassInst c d) = Just . Str $ "Class_" ++ escID c ++ "_Data_" ++ escID d+ctypeID (DefInst c) = Just . Str $ "DefaultInstance_" ++ escID c+ctypeID (ModPath p) = Just . Str $ "Directory_" ++ escID p escID :: String -> String escID = filter (\c -> isLetter c || isDigit c || c == '_')
SourceGraph.cabal view
@@ -1,5 +1,5 @@ Name: SourceGraph-Version: 0.5.1.0+Version: 0.5.2.0 Synopsis: Use graph-theory to analyse your code Description: { Statically analyse Haskell source code using graph-theoretic
TODO view
@@ -12,3 +12,8 @@ * Write a README +* Find where spurious class function entities are coming from.++* Fix up printing of entities for node lists.++* Add a legend.