elm-analyse icon indicating copy to clipboard operation
elm-analyse copied to clipboard

UnnecessaryParens false positive

Open andys8 opened this issue 5 years ago • 2 comments

Example

myButton : Bool -> Element msg
myButton newTab =
    (if newTab then
        newTabLink

     else
        link
    )
        []
        { url = "https://google.de"
        , label = text "Label"
        }

will trigger Unnecessary

But removing the parens results in wrong code:

myButton : Bool -> Element msg
myButton newTab =
    if newTab then
        newTabLink

    else
        link
            []
            { url = "https://google.de"
            , label = text "Label"
            }

andys8 avatar Apr 02 '19 10:04 andys8

Another example:

(if flags.can PurchaseBundles then
    (::) Store.UserSettings.fetchBundles

 else
    identity
)
    [ Store.UserSettings.fetchCreditCard
    , Store.UserSettings.fetchCountries
    , Store.UserSettings.fetchReceipts 1
    ]

Janiczek avatar Jul 02 '19 11:07 Janiczek

Simplest example: (hours-24)*60

is flagged, but (hours - 24)*60 is not

csar avatar Feb 25 '20 14:02 csar