mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 10:14:04 +03:00
Simplify code
This commit is contained in:
parent
8f9878c29e
commit
dda4c684b1
@ -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
|
||||
|
@ -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 =
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user