exercism / elm-analyzer

GNU Affero General Public License v3.0
1 stars 4 forks source link

False positive on `top-scorers` #51

Closed FabHof closed 1 year ago

FabHof commented 1 year ago
removeInsignificantPlayers : Int -> Dict PlayerName Int -> Dict PlayerName Int
removeInsignificantPlayers goalThreshold playerGoalCounts =
    playerGoalCounts
        |> Dict.filter (\_ count -> count >= goalThreshold)

This solution triggers removeInsignificantPlayersMustUseFilter although Dict.filter is used

ceddlyburge commented 1 year ago

Thanks Fabian, we will look in to this.

jiegillet commented 1 year ago

Hi @FabHof, I can't seem to reproduce this.

Would you mind sharing your full solution and copy the comment you saw? Alternatively, you could send us a mentoring link so we can take a look ourselves.

Screen Shot 2022-11-12 at 10 19 49
FabHof commented 1 year ago

Sure, here it is: https://exercism.org/mentoring/external_requests/41d0f02be3a34ea2a9f6853d8133a32e

jiegillet commented 1 year ago

Thank you for sharing, I've identified the problem.

You received this comment, which is supposed to tell you about another problem, but instead it is a duplicate of this one. @ceddlyburge, could I ask you to rewrite the comment?

The real comment should be about this function:

resetPlayerGoalCount : PlayerName -> Dict PlayerName Int -> Dict PlayerName Int
resetPlayerGoalCount playerName playerGoalCounts =
    playerGoalCounts
        |> Dict.update playerName (\_ -> Just 0)

and tell you that Dict.insert is the most appropriate function to use in this case because it doesn't require to define a function unlike Dict.update.

ceddlyburge commented 1 year ago

Thanks @jie, I'll take a look at that ...