mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-25 10:04:38 +03:00
Avoid List.head
This commit is contained in:
parent
1c072d4b92
commit
04102ce097
@ -1038,20 +1038,19 @@ maybeCons mapper maybe list =
|
|||||||
expectErrorsForModulesHelp : RuleCanProvideFixes -> List ( String, List ExpectedError ) -> List SuccessfulRunResult -> Expectation
|
expectErrorsForModulesHelp : RuleCanProvideFixes -> List ( String, List ExpectedError ) -> List SuccessfulRunResult -> Expectation
|
||||||
expectErrorsForModulesHelp ruleCanProvideFixes expectedErrorsList runResults =
|
expectErrorsForModulesHelp ruleCanProvideFixes expectedErrorsList runResults =
|
||||||
let
|
let
|
||||||
maybeUnknownModule : Maybe String
|
unknownModules : List String
|
||||||
maybeUnknownModule =
|
unknownModules =
|
||||||
Set.diff
|
Set.diff
|
||||||
(expectedErrorsList |> List.map Tuple.first |> Set.fromList)
|
(expectedErrorsList |> List.map Tuple.first |> Set.fromList)
|
||||||
(Set.fromList (List.map .moduleName runResults))
|
(Set.fromList (List.map .moduleName runResults))
|
||||||
|> Set.toList
|
|> Set.toList
|
||||||
|> List.head
|
|
||||||
in
|
in
|
||||||
case maybeUnknownModule of
|
case unknownModules of
|
||||||
Just unknownModule ->
|
unknownModule :: _ ->
|
||||||
FailureMessage.unknownModulesInExpectedErrors unknownModule
|
FailureMessage.unknownModulesInExpectedErrors unknownModule
|
||||||
|> Expect.fail
|
|> Expect.fail
|
||||||
|
|
||||||
Nothing ->
|
[] ->
|
||||||
Expect.all
|
Expect.all
|
||||||
(expectErrorsForModuleFiles ruleCanProvideFixes expectedErrorsList runResults)
|
(expectErrorsForModuleFiles ruleCanProvideFixes expectedErrorsList runResults)
|
||||||
()
|
()
|
||||||
|
Loading…
Reference in New Issue
Block a user