Skip to content

Commit

Permalink
fix some deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mpollmeier committed Apr 25, 2024
1 parent 2f59dd6 commit 739a6a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class RepeatTraversalTests extends AnyWordSpec with ExampleGraphSetup {
"traverses all nodes to outer limits exactly once, emitting and returning nothing, by default" in {
val traversedNodes = mutable.ListBuffer.empty[Any]

def test(traverse: => Iterable[_]) = {
def test(traverse: => Iterable[?]) = {
traversedNodes.clear()
val results = traverse
traversedNodes.size shouldBe 9
Expand Down
17 changes: 9 additions & 8 deletions formats/src/test/scala/flatgraph/testutils/ProjectRoot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.nio.file.{Files, Paths}
*/
object ProjectRoot {

private val SEARCH_DEPTH = 6
private val MaxSearchDepth = 6
object SearchDepthExceededError extends Error

def relativise(path: String): String =
Expand All @@ -21,15 +21,16 @@ object ProjectRoot {
def findRelativePath: String = {
val fileThatOnlyExistsInRoot = ".git"

for (depth <- 0 to SEARCH_DEPTH) {
val pathPrefix = "./" + "../" * depth

if (Files.exists(Paths.get(s"$pathPrefix$fileThatOnlyExistsInRoot"))) {
return pathPrefix
}
var currentDepth = 0
var currentAttempt = "./"
def foundIt: Boolean = Files.exists(Paths.get(s"$currentAttempt$fileThatOnlyExistsInRoot"))
while (!foundIt && currentDepth < MaxSearchDepth) {
currentAttempt += "../"
currentDepth += 1
}

throw SearchDepthExceededError
if (foundIt) currentAttempt
else throw SearchDepthExceededError
}

}

0 comments on commit 739a6a9

Please sign in to comment.