Skip to content

Commit

Permalink
Extract function
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Sep 3, 2023
1 parent 43f533e commit 39f2624
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/CognitiveComplexity.elm
Expand Up @@ -751,7 +751,7 @@ processDFSTree graph stack visited =
[] ->
{ recursiveCalls = Dict.empty, visited = visited, stack = [] }

head :: _ ->
head :: restOfStack ->
let
vertices : List String
vertices =
Expand Down Expand Up @@ -781,12 +781,19 @@ processDFSTree graph stack visited =
)
{ recursiveCalls = Dict.empty, visited = visited }
vertices
|> (\res ->
{ recursiveCalls = res.recursiveCalls
, visited = Dict.insert head Done res.visited
, stack = List.drop 1 stack
}
)
|> updateStack head restOfStack


updateStack :
String
-> List String
-> { recursiveCalls : RecursiveCalls, visited : Visited }
-> { recursiveCalls : RecursiveCalls, visited : Visited, stack : List String }
updateStack head stack res =
{ recursiveCalls = res.recursiveCalls
, visited = Dict.insert head Done res.visited
, stack = stack
}


dataExtractor : ProjectContext -> Encode.Value
Expand Down

0 comments on commit 39f2624

Please sign in to comment.