Skip to content

Commit

Permalink
Fix imports in tests, fix line separator
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrakal committed Jul 28, 2024
1 parent 1f389c8 commit e7c9129
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
8 changes: 2 additions & 6 deletions plugin/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
<file name="src/main/kotlin/com/jraska/module/graph/assertion/ModuleTreeHeightAssert.kt">
<error line="27" column="141" source="standard:max-line-length" />
<error line="37" column="141" source="standard:max-line-length" />
</file>
<file name="src/test/kotlin/com/jraska/module/graph/assertion/OnAnyBuildAssertTest.kt">
<error line="128" column="141" source="standard:max-line-length" />
<file name="src/test/kotlin/com/jraska/module/graph/assertion/FullProjectRootGradleTest.kt">
<error line="95" column="141" source="standard:max-line-length" />
</file>
</baseline>
2 changes: 2 additions & 0 deletions plugin/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<ManuallySuppressedIssues></ManuallySuppressedIssues>
<CurrentIssues>
<ID>LongMethod:DependencyGraphTest.kt$DependencyGraphTest$@Test fun countsStatisticsWell()</ID>
<ID>MaxLineLength:FullProjectMultipleAppliedGradleTest.kt$FullProjectMultipleAppliedGradleTest$"GraphStatistics(modulesCount=3, edgesCount=3, height=2, longestPath=':app -&gt; :core -&gt; :core-api')${System.lineSeparator()}"</ID>
<ID>MaxLineLength:FullProjectRootGradleTest.kt$FullProjectRootGradleTest$"GraphStatistics\\(modulesCount=1, edgesCount=0, height=0, longestPath=\'root.*\'\\)${System.lineSeparator()}${System.lineSeparator()}"</ID>
<ID>MaxLineLength:ModuleTreeHeightAssert.kt$ModuleTreeHeightAssert$"Module $moduleName is allowed to have maximum height of $maxHeight, but has $height, problematic dependencies: ${longestPath.pathString()}"</ID>
<ID>MaxLineLength:ModuleTreeHeightAssert.kt$ModuleTreeHeightAssert$"Module Graph is allowed to have maximum height of $maxHeight, but has $height, problematic dependencies: ${longestPath.pathString()}"</ID>
<ID>MaxLineLength:OnAnyBuildAssertTest.kt$OnAnyBuildAssertTest$"""["App"(':app') -&gt; "Implementation"(':core'), "App"(':app') -&gt; "Implementation"(':feature')] not allowed by any of ['Implementation -&gt; Api', 'App -&gt; Api']"""</ID>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.jraska.module.graph.assertion

import org.hamcrest.CoreMatchers
import org.hamcrest.MatcherAssert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -129,9 +127,8 @@ class FullProjectGradleTest {
"-Pmodules.graph.of.module=:feature",
).output

MatcherAssert.assertThat(
output,
CoreMatchers.containsString(
assert(
output.contains(
"digraph G {\n" +
"\":feature('Implementation')\" -> \":core-api('Api')\" [color=red style=bold]\n" +
"}",
Expand All @@ -148,9 +145,8 @@ class FullProjectGradleTest {
"-Pmodules.graph.of.module=:feature",
).output

MatcherAssert.assertThat(
output,
CoreMatchers.containsString(
assert(
output.contains(
"GraphStatistics(modulesCount=2, edgesCount=1, height=1, longestPath=':feature -> :core-api')",
),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.jraska.module.graph.assertion

import org.hamcrest.CoreMatchers
import org.hamcrest.MatcherAssert
import org.junit.Before
import org.junit.Rule
import org.junit.Test
Expand Down Expand Up @@ -76,13 +74,12 @@ class FullProjectMultipleAppliedGradleTest {
runGradleAssertModuleGraph(testProjectDir.root, "generateModulesGraphStatistics").output

println(output)
MatcherAssert.assertThat(
output,
CoreMatchers.containsString(
"> Task :app:generateModulesGraphStatistics\n" +
"GraphStatistics(modulesCount=3, edgesCount=3, height=2, longestPath=':app -> :core -> :core-api')\n" +
"\n" +
"> Task :no-dependencies:generateModulesGraphStatistics\n" +
assert(
output.contains(
"> Task :app:generateModulesGraphStatistics${System.lineSeparator()}" +
"GraphStatistics(modulesCount=3, edgesCount=3, height=2, longestPath=':app -> :core -> :core-api')${System.lineSeparator()}" +
"${System.lineSeparator()}" +
"> Task :no-dependencies:generateModulesGraphStatistics${System.lineSeparator()}" +
"GraphStatistics(modulesCount=1, edgesCount=0, height=0, longestPath=':no-dependencies')",
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class FullProjectRootGradleTest {
assert(
output.contains(
(
"> Task :generateModulesGraphStatistics\n.*" +
"> Task :generateModulesGraphStatistics${System.lineSeparator()}.*" +
"GraphStatistics\\(modulesCount=2, edgesCount=1, height=1, longestPath=\'root.* -> :core\'\\)"
).toRegex(),
),
Expand Down Expand Up @@ -91,9 +91,9 @@ class FullProjectRootGradleTest {
assert(
output.contains(
(
"> Task :generateModulesGraphStatistics\n.*" +
"GraphStatistics\\(modulesCount=1, edgesCount=0, height=0, longestPath=\'root.*\'\\)\n\n" +
"> Task :app:generateModulesGraphStatistics\n+" +
"> Task :generateModulesGraphStatistics${System.lineSeparator()}.*" +
"GraphStatistics\\(modulesCount=1, edgesCount=0, height=0, longestPath=\'root.*\'\\)${System.lineSeparator()}${System.lineSeparator()}" +
"> Task :app:generateModulesGraphStatistics${System.lineSeparator()}+" +
"GraphStatistics\\(modulesCount=1, edgesCount=0, height=0, longestPath=\':app\'\\)"
).toRegex(),
),
Expand Down

0 comments on commit e7c9129

Please sign in to comment.