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 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 color string =
String.join "" [ "\u{001B}[" ++ color ++ "m", string, noColor ]
String.concat [ "\u{001B}[" ++ color ++ "m", string, noColor ]
red : String -> String
@ -43,7 +43,7 @@ noColor =
applyBackgroundColor : String -> String -> String
applyBackgroundColor color string =
String.join "" [ "\u{001B}[" ++ color ++ "m", string, noBackgroundColor ]
String.concat [ "\u{001B}[" ++ color ++ "m", string, noBackgroundColor ]
backgroundRed : String -> String

View File

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

View File

@ -90,7 +90,7 @@ The source code in question is the one at index """
++ """ 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
failureMessage "TEST SOURCE CODE PARSING ERROR" (details ++ "\n\n" ++ hint)

View File

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