Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shortening big if clause still creates compiler warnings #1390

Closed
1 of 2 tasks
knocte opened this issue Jan 24, 2021 · 1 comment · Fixed by #1454
Closed
1 of 2 tasks

Shortening big if clause still creates compiler warnings #1390

knocte opened this issue Jan 24, 2021 · 1 comment · Fixed by #1454

Comments

@knocte
Copy link
Contributor

knocte commented Jan 24, 2021

Issue created from fantomas-online

Code

module Web3ServerSeedList =
    let MaybeRethrow (ex: Exception): unit =
        let rpcResponseExOpt =
            FSharpUtil.FindException<RpcResponseException>
                ex

        match rpcResponseExOpt with
        | Some rpcResponseEx ->
            if rpcResponseEx.RpcError <> null then
                if (not (rpcResponseEx.RpcError.Message.Contains "pruning=archive"))
                       && (not (rpcResponseEx.RpcError.Message.Contains "header not found"))
                       && (not (rpcResponseEx.RpcError.Message.Contains "missing trie node")) then
                        raise UnexpectedRpcResponseError
        | _ -> ()

Result

module Web3ServerSeedList =
    let MaybeRethrow (ex: Exception): unit =
        let rpcResponseExOpt =
            FSharpUtil.FindException<RpcResponseException> ex

        match rpcResponseExOpt with
        | Some rpcResponseEx ->
            if rpcResponseEx.RpcError <> null then
                if (not (
                    rpcResponseEx.RpcError.Message.Contains "pruning=archive"
                   ))
                   && (not (
                       rpcResponseEx.RpcError.Message.Contains
                           "header not found"
                   ))
                   && (not (
                       rpcResponseEx.RpcError.Message.Contains
                           "missing trie node"
                   )) then
                    raise UnexpectedRpcResponseError
        | _ -> ()

Problem description

F# compiler yields warnings after formatting with fantomas. However, I'm unsure about what the expected results should be (that would make no compiler warnings), please help.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • [maybe] I or my company would be willing to help fix this.

Options

Fantomas Master at 01/23/2021 17:11:48 - 6d75fff

    { config with
                MaxLineLength = 80 }
@nojaf
Copy link
Contributor

nojaf commented Jan 26, 2021

Hmm, this is a tricky one.
I feel like it is time I solve fsprojects/fantomas-tools#137 first.
And have a better insight on where warnings and errors occur in the online tool.

I think the first rpcResponseEx.RpcError should be further indented but that is speculation at this point.

knocte added a commit to nblockchain/geewallet that referenced this issue Jan 27, 2021
And at the same time hopefully we workaround a fantomas bug which might
be tricky to fix: fsprojects/fantomas#1390
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants