FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

Optional parameters falsely flagged

Open Shmew opened this issue 6 years ago • 2 comments

Warnings are thrown for optional bool parameters

`x = true` might be able to be refactored into `x`.
silentHttpErrors = true

https://github.com/fsharp/FSharp.Data/blob/master/src/Net/Http.fs#L1704

Shmew avatar Apr 17 '19 20:04 Shmew

Hi @Shmew, thanks for the bug report. When you get a chance, could you please provide a minimum example that reproduces this issue?

jgardella avatar May 06 '19 20:05 jgardella

module Example

open FSharp.Data

let test () =
    let uri = @"https://petstore.swagger.io/v2/pet/findByStatus?status=available"

    let heads = 
      [ HttpRequestHeaders.ContentLanguage HttpContentTypes.Json
        HttpRequestHeaders.Accept @"*/*"
        HttpRequestHeaders.AcceptEncoding "UTF8"
        HttpRequestHeaders.ContentType HttpContentTypes.Json
        HttpRequestHeaders.ContentEncoding "UTF8" ]

    Http.Request(uri, httpMethod = "GET", headers = heads, silentHttpErrors = true)
========== Linting .\Example.fs ==========
`x = true` might be able to be refactored into `x`.
Error in file .\Example.fs on line 14 starting at column 59
    Http.Request(uri, httpMethod = "GET", headers = heads, silentHttpErrors = true)
                                                           ^
--------------------------------------------------------------------------------
========== Finished: 1 warnings ==========
========== Summary: 1 warnings ==========

Hey @jgardella sorry for taking so long, I forgot about this.

Shmew avatar May 15 '19 15:05 Shmew