Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify spacing in dot graph generated by Visualize #426

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions testdata/dig_as_two.dot
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
digraph {
rankdir=RL;
graph [compound=true];

subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func4.1"];

"io.Reader" [label=<io.Reader>];
"io.Writer" [label=<io.Writer>];

}



subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func4.1"];
"io.Reader" [label=<io.Reader>];
"io.Writer" [label=<io.Writer>];
}
}
2 changes: 0 additions & 2 deletions testdata/empty.dot
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
digraph {
rankdir=RL;
graph [compound=true];


}
68 changes: 26 additions & 42 deletions testdata/error.dot
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,34 @@ digraph {
rankdir=RL;
graph [compound=true];
"[type=dig_test.t1 group=g1]" [shape=diamond label=<dig_test.t1<BR /><FONT POINT-SIZE="10">Group: g1</FONT>> color=red];
"[type=dig_test.t1 group=g1]" -> "dig_test.t1[group=g1]0";

"[type=dig_test.t1 group=g1]" -> "dig_test.t1[group=g1]0";
"[type=dig_test.t2 group=g2]" [shape=diamond label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>> color=orange];
"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]0";
"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]2";


subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.1"];
color=orange;
"dig_test.t3[name=n3]" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Name: n3</FONT>>];
"dig_test.t2[group=g2]0" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];

}


constructor_0 -> "[type=dig_test.t1 group=g1]" [ltail=cluster_0];

subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func7.2"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];

}

constructor_1 -> "dig_test.t3[name=n3]" [ltail=cluster_1];


constructor_1 -> "[type=dig_test.t2 group=g2]" [ltail=cluster_1];

subgraph cluster_2 {
label = "go.uber.org/dig_test";
constructor_2 [shape=plaintext label="TestVisualize.func7.4"];
color=red;
"dig_test.t1[group=g1]0" [label=<dig_test.t1<BR /><FONT POINT-SIZE="10">Group: g1</FONT>>];
"dig_test.t2[group=g2]2" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];

}


"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]0";
"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]2";
subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.1"];
color=orange;
"dig_test.t3[name=n3]" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Name: n3</FONT>>];
"dig_test.t2[group=g2]0" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];
}
constructor_0 -> "[type=dig_test.t1 group=g1]" [ltail=cluster_0];
subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func7.2"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];
}
constructor_1 -> "dig_test.t3[name=n3]" [ltail=cluster_1];
constructor_1 -> "[type=dig_test.t2 group=g2]" [ltail=cluster_1];
subgraph cluster_2 {
label = "go.uber.org/dig_test";
constructor_2 [shape=plaintext label="TestVisualize.func7.4"];
color=red;
"dig_test.t1[group=g1]0" [label=<dig_test.t1<BR /><FONT POINT-SIZE="10">Group: g1</FONT>>];
"dig_test.t2[group=g2]2" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];
}
"dig_test.t2[group=g2]0" [color=orange];
"dig_test.t4" [color=orange];
"dig_test.t1[group=g1]0" [color=red];

}
52 changes: 18 additions & 34 deletions testdata/grouped.dot
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,22 @@ digraph {
rankdir=RL;
graph [compound=true];
"[type=dig_test.t3 group=foo]" [shape=diamond label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Group: foo</FONT>>];
"[type=dig_test.t3 group=foo]" -> "dig_test.t3[group=foo]0";
"[type=dig_test.t3 group=foo]" -> "dig_test.t3[group=foo]1";


subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func6.1"];

"dig_test.t3[group=foo]0" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Group: foo</FONT>>];

}


subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func6.2"];

"dig_test.t3[group=foo]1" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Group: foo</FONT>>];

}


subgraph cluster_2 {
label = "go.uber.org/dig_test";
constructor_2 [shape=plaintext label="TestVisualize.func6.3"];

"dig_test.t2" [label=<dig_test.t2>];

}


constructor_2 -> "[type=dig_test.t3 group=foo]" [ltail=cluster_2];


"[type=dig_test.t3 group=foo]" -> "dig_test.t3[group=foo]0";
"[type=dig_test.t3 group=foo]" -> "dig_test.t3[group=foo]1";
subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func6.1"];
"dig_test.t3[group=foo]0" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Group: foo</FONT>>];
}
subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func6.2"];
"dig_test.t3[group=foo]1" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Group: foo</FONT>>];
}
subgraph cluster_2 {
label = "go.uber.org/dig_test";
constructor_2 [shape=plaintext label="TestVisualize.func6.3"];
"dig_test.t2" [label=<dig_test.t2>];
}
constructor_2 -> "[type=dig_test.t3 group=foo]" [ltail=cluster_2];
}
26 changes: 9 additions & 17 deletions testdata/missing.dot
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
digraph {
rankdir=RL;
graph [compound=true];

subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func8.1"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];

}

constructor_0 -> "dig_test.t1" [ltail=cluster_0];

constructor_0 -> "dig_test.t2" [ltail=cluster_0];

constructor_0 -> "dig_test.t3" [ltail=cluster_0];


subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func8.1"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];
}
constructor_0 -> "dig_test.t1" [ltail=cluster_0];
constructor_0 -> "dig_test.t2" [ltail=cluster_0];
constructor_0 -> "dig_test.t3" [ltail=cluster_0];
"dig_test.t4" [color=orange];
"dig_test.t1" [color=red];
"dig_test.t2" [color=red];
"dig_test.t3" [color=red];

}
2 changes: 0 additions & 2 deletions testdata/missingDep.dot
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
digraph {
rankdir=RL;
graph [compound=true];

"dig_test.t1" [color=red];

}
35 changes: 12 additions & 23 deletions testdata/named.dot
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
digraph {
rankdir=RL;
graph [compound=true];

subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func3.1"];

"dig_test.t1[name=bar]" [label=<dig_test.t1<BR /><FONT POINT-SIZE="10">Name: bar</FONT>>];
"dig_test.t2[name=baz]" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Name: baz</FONT>>];

}

constructor_0 -> "dig_test.t3[name=foo]" [ltail=cluster_0];


subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func3.2"];

"dig_test.t3[name=foo]" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Name: foo</FONT>>];

}



subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func3.1"];
"dig_test.t1[name=bar]" [label=<dig_test.t1<BR /><FONT POINT-SIZE="10">Name: bar</FONT>>];
"dig_test.t2[name=baz]" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Name: baz</FONT>>];
}
constructor_0 -> "dig_test.t3[name=foo]" [ltail=cluster_0];
subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func3.2"];
"dig_test.t3[name=foo]" [label=<dig_test.t3<BR /><FONT POINT-SIZE="10">Name: foo</FONT>>];
}
}
33 changes: 11 additions & 22 deletions testdata/optional.dot
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
digraph {
rankdir=RL;
graph [compound=true];

subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func5.1"];

"dig_test.t1" [label=<dig_test.t1>];

}


subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func5.2"];

"dig_test.t2" [label=<dig_test.t2>];

}

constructor_1 -> "dig_test.t1" [ltail=cluster_1 style=dashed];



subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func5.1"];
"dig_test.t1" [label=<dig_test.t1>];
}
subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func5.2"];
"dig_test.t2" [label=<dig_test.t2>];
}
constructor_1 -> "dig_test.t1" [ltail=cluster_1 style=dashed];
}
38 changes: 14 additions & 24 deletions testdata/prune_constructor_result.dot
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,20 @@ digraph {
rankdir=RL;
graph [compound=true];
"[type=dig_test.t2 group=g2]" [shape=diamond label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>> color=red];
"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]1";


subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.6.1.2"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];

}


constructor_0 -> "[type=dig_test.t2 group=g2]" [ltail=cluster_0];

subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func7.6.1.3"];
color=red;
"dig_test.t2[group=g2]1" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];

}


"[type=dig_test.t2 group=g2]" -> "dig_test.t2[group=g2]1";
subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.6.1.2"];
color=orange;
"dig_test.t4" [label=<dig_test.t4>];
}
constructor_0 -> "[type=dig_test.t2 group=g2]" [ltail=cluster_0];
subgraph cluster_1 {
label = "go.uber.org/dig_test";
constructor_1 [shape=plaintext label="TestVisualize.func7.6.1.3"];
color=red;
"dig_test.t2[group=g2]1" [label=<dig_test.t2<BR /><FONT POINT-SIZE="10">Group: g2</FONT>>];
}
"dig_test.t4" [color=orange];
"dig_test.t2[group=g2]1" [color=red];

}
17 changes: 6 additions & 11 deletions testdata/prune_non_root_nodes.dot
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
digraph {
rankdir=RL;
graph [compound=true];

subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.6.2.2"];
color=red;
"dig_test.t4" [label=<dig_test.t4>];

}


subgraph cluster_0 {
label = "go.uber.org/dig_test";
constructor_0 [shape=plaintext label="TestVisualize.func7.6.2.2"];
color=red;
"dig_test.t4" [label=<dig_test.t4>];
}
"dig_test.t4" [color=red];

}
Loading