Simplify code

This commit is contained in:
Jeroen Engels 2021-04-24 14:33:20 +02:00
parent 8f9878c29e
commit dda4c684b1
4 changed files with 7 additions and 13 deletions

View File

@ -5,7 +5,7 @@ module Ansi exposing (backgroundRed, bold, cyan, red, yellow)
bold : String -> String bold : String -> String
bold text = bold text =
String.join "" [ "\u{001B}[1m", text, "\u{001B}[22m" ] String.concat [ "\u{001B}[1m", text, "\u{001B}[22m" ]
@ -14,7 +14,7 @@ bold text =
applyColor : String -> String -> String applyColor : String -> String -> String
applyColor color string = applyColor color string =
String.join "" [ "\u{001B}[" ++ color ++ "m", string, noColor ] String.concat [ "\u{001B}[" ++ color ++ "m", string, noColor ]
red : String -> String red : String -> String
@ -43,7 +43,7 @@ noColor =
applyBackgroundColor : String -> String -> String applyBackgroundColor : String -> String -> String
applyBackgroundColor color string = applyBackgroundColor color string =
String.join "" [ "\u{001B}[" ++ color ++ "m", string, noBackgroundColor ] String.concat [ "\u{001B}[" ++ color ++ "m", string, noBackgroundColor ]
backgroundRed : String -> String backgroundRed : String -> String

View File

@ -765,7 +765,7 @@ duplicateModulesGlobalError duplicate =
duplicate.paths duplicate.paths
|> List.sort |> List.sort
|> List.map (\s -> "\n - " ++ s) |> List.map (\s -> "\n - " ++ s)
|> String.join "" |> String.concat
in in
elmReviewGlobalError elmReviewGlobalError
{ message = "Found several modules named `" ++ String.join "." duplicate.moduleName ++ "`" { message = "Found several modules named `" ++ String.join "." duplicate.moduleName ++ "`"
@ -3678,12 +3678,7 @@ runProjectVisitor name projectVisitor maybePreviousCache exceptions project node
errors : List (Error {}) errors : List (Error {})
errors = errors =
case projectVisitor.traversalAndFolder of Exceptions.apply exceptions (accessInternalError >> .filePath) (errorsFromCache newCache)
TraverseAllModulesInParallel _ ->
Exceptions.apply exceptions (accessInternalError >> .filePath) (errorsFromCache newCache)
TraverseImportedModulesFirst _ ->
Exceptions.apply exceptions (accessInternalError >> .filePath) (errorsFromCache newCache)
in in
{ errors = List.map (setRuleName name) errors { errors = List.map (setRuleName name) errors
, rule = , rule =

View File

@ -90,7 +90,7 @@ The source code in question is the one at index """
++ """ starting with: ++ """ starting with:
`""" `"""
++ (String.join "" <| List.take 1 <| String.split "\n" <| String.trim source) ++ (String.concat <| List.take 1 <| String.split "\n" <| String.trim source)
++ "`" ++ "`"
in in
failureMessage "TEST SOURCE CODE PARSING ERROR" (details ++ "\n\n" ++ hint) failureMessage "TEST SOURCE CODE PARSING ERROR" (details ++ "\n\n" ++ hint)

View File

@ -531,8 +531,7 @@ collectUsedCustomTypeArgs lookupTable (Node range pattern) =
in in
case ModuleNameLookupTable.moduleNameAt lookupTable range of case ModuleNameLookupTable.moduleNameAt lookupTable range of
Just moduleName -> Just moduleName ->
[ ( ( moduleName, name ), usedPositions ) ] ( ( moduleName, name ), usedPositions ) :: subList
++ subList
Nothing -> Nothing ->
subList subList