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

Use rank feature only when necessary. #3

Merged
merged 1 commit into from
Mar 4, 2018
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ internal class DotGenerator(
content.append(" $projectId $settings;\n")
}

// All projects should be displayed on the same level.
val ranking = projects.joinToString(separator = "; ") { "\"${it.dotIdentifier(projectSuffix)}\"" }
content.append(" { rank = same; $ranking };\n")
if (projects.size > 1) {
// All projects should be displayed on the same level.
val ranking = projects.joinToString(separator = "; ") { "\"${it.dotIdentifier(projectSuffix)}\"" }
content.append(" { rank = same; $ranking };\n")
}

// Let's gather everything and put it in the file.
projects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleEmpty, ALL).generateContent()).isEqualTo("""
|digraph G {
| singleempty [label="singleempty", shape="box"];
| { rank = same; "singleempty" };
|}
|""".trimMargin())
}
Expand All @@ -60,7 +59,6 @@ class DotGeneratorTest {
|digraph G {
| label="my custom header" fontsize="24" height="5" labelloc="t" labeljust="c";
| singleempty [label="singleempty", shape="box"];
| { rank = same; "singleempty" };
|}
|""".trimMargin())
}
Expand All @@ -69,7 +67,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleEmpty, ALL.copy(rootSuffix = "my suffix")).generateContent()).isEqualTo("""
|digraph G {
| singleemptymysuffix [label="singleempty my suffix", shape="box"];
| { rank = same; "singleemptymysuffix" };
|}
|""".trimMargin())
}
Expand All @@ -78,7 +75,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleEmpty, ALL.copy(rootFormattingOptions = GraphFormattingOptions(Shape.EGG, Style.DOTTED, Color.fromHex("#ff0099")))).generateContent()).isEqualTo("""
|digraph G {
| singleempty [label="singleempty", shape="egg", style="dotted", color="#ff0099"];
| { rank = same; "singleempty" };
|}
|""".trimMargin())
}
Expand All @@ -87,7 +83,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleProject, ALL).generateContent()).isEqualTo("""
|digraph G {
| single [label="single", shape="box"];
| { rank = same; "single" };
| orgjetbrainskotlinkotlinstdlib [label="kotlin-stdlib", shape="box"];
| single -> orgjetbrainskotlinkotlinstdlib;
| orgjetbrainsannotations [label="annotations", shape="box"];
Expand All @@ -111,7 +106,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleProject, ALL.copy(dependencyFormattingOptions = dependencyFormattingOptions)).generateContent()).isEqualTo("""
|digraph G {
| single [label="single", shape="box"];
| { rank = same; "single" };
| orgjetbrainskotlinkotlinstdlib [label="kotlin-stdlib", shape="box", color="#6ba46e"];
| single -> orgjetbrainskotlinkotlinstdlib;
| orgjetbrainsannotations [label="annotations", shape="box", color="#4a09b2"];
Expand All @@ -129,7 +123,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleProject, ALL.copy(children = { false })).generateContent()).isEqualTo("""
|digraph G {
| single [label="single", shape="box"];
| { rank = same; "single" };
| orgjetbrainskotlinkotlinstdlib [label="kotlin-stdlib", shape="box"];
| single -> orgjetbrainskotlinkotlinstdlib;
| ioreactivexrxjava2rxjava [label="rxjava", shape="box"];
Expand All @@ -143,7 +136,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleProject, ALL.copy(include = { it.moduleGroup != "io.reactivex.rxjava2" })).generateContent()).isEqualTo("""
|digraph G {
| single [label="single", shape="box"];
| { rank = same; "single" };
| orgjetbrainskotlinkotlinstdlib [label="kotlin-stdlib", shape="box"];
| single -> orgjetbrainskotlinkotlinstdlib;
| orgjetbrainsannotations [label="annotations", shape="box"];
Expand All @@ -159,7 +151,6 @@ class DotGeneratorTest {
assertThat(DotGenerator(singleProject, ALL).generateContent()).isEqualTo("""
|digraph G {
| single [label="single", shape="box"];
| { rank = same; "single" };
| orgjetbrainskotlinkotlinstdlib [label="kotlin-stdlib", shape="box"];
| single -> orgjetbrainskotlinkotlinstdlib;
| orgjetbrainsannotations [label="annotations", shape="box"];
Expand Down