GithubHelp home page GithubHelp logo

nblockchain / fantomless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fsprojects/fantomas

3.0 3.0 5.0 72.29 MB

FSharp source code formatter

Home Page: https://fsprojects.github.io/fantomas-tools/#/fantomas/preview

License: Other

F# 99.96% Batchfile 0.01% Shell 0.03%

fantomless's People

Contributors

anthonylloyd avatar auduchinok avatar baronfel avatar bobface avatar btzo avatar dawedawe avatar deviousasti avatar dsyme avatar dungpa avatar enricosada avatar erikschierboom avatar fizzixnerd avatar forki avatar jackmatusiewicz avatar janus avatar jaredpar avatar jindraivanek avatar kentcb avatar knocte avatar nojaf avatar okayx6 avatar pbiggar avatar ribeirotomas1904 avatar s-trooper avatar sasmithjr avatar smoothdeveloper avatar su8898 avatar theimowski avatar theothornhill avatar vasily-kirichenko avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

fantomless's Issues

Bad formatting of nested functions

// TODO: create minimal test case
Testcase location: aarani/NOnion@5c1818e#diff-84bc2676d83024ec1f393eca9ce3a3ca06bca5bf36753c90c252f4c9f020c296R179

Expected behavior:

    member self.GetRouter(filter: RouterType) =
        async {
            do! self.UpdateConsensusIfNotLive()
            let randomServerOpt =
                self.NetworkStatus.Routers
                |> match filter with
                   | Normal -> Seq.ofList
                   | Directory ->
                       Seq.filter(fun router ->
                           router.DirectoryPort.IsSome
                           && router.DirectoryPort.Value > 0
                       )
                   | Guard ->
                       Seq.filter(fun router ->
                           Seq.contains "Guard" router.Flags
                       )
                   | Exit ->
                       Seq.filter(fun router ->
                           Seq.contains "Exit" router.Flags
                       )
                |> SeqUtils.TakeRandom 1
                |> Seq.tryHead

Actual behavior:

    member self.GetRouter(filter: RouterType) =
        async {
            do! self.UpdateConsensusIfNotLive()
            let randomServerOpt =
                self.NetworkStatus.Routers
                |> match filter with
                   | Normal -> Seq.ofList
                   | Directory ->
                       Seq.filter(fun router ->
                           router.DirectoryPort.IsSome
                           && router.DirectoryPort.Value > 0
                       )
                   | Guard ->
                       Seq.filter(fun router ->
                           Seq.contains "Guard" router.Flags
                       )
                   | Exit ->
                       Seq.filter(fun router -> Seq.contains "Exit" router.Flags
                       )
                |> SeqUtils.TakeRandom 1
                |> Seq.tryHead

Configuration: https://github.com/aarani/NOnion/blob/5c1818e73179d65a8cb5c082b4dcec6dd2d26c3e/.editorconfig

[Feature request] Replace %d with %i

Test1:

Console.WriteLine(sprintf "%d" 3)

should become:

Console.WriteLine(sprintf "%i" 3)

Test2:

// %d
Console.WriteLine(3)

should become:

// %d
Console.WriteLine(3)

(should not change)


Test3:

Console.WriteLine("%d")

should become:

Console.WriteLine("%d")

(should not change)

[Feature request] Remove parenthesis when using `raise` keyword

Test1:

raise(InvalidPassword)

should become:

raise InvalidPassword

Test2:

raise InvalidPassword

should become (same):

raise InvalidPassword

(should not change)


Test3:

raise(AddressWithInvalidChecksum None)

should become:

raise <| AddressWithInvalidChecksum None

Test4:

raise(Exception("foo"))

should become:

raise <| Exception("foo")

Test5:

raise(Exception(ex.ToString(), (ex.InnerException)))

should become:

raise <| Exception(ex.ToString(), (ex.InnerException))

Remove unneeded parentheses in for loop

let private GrabTheFirstStringBeforeTheFirstColon (lines: seq<string>) =
    seq {
        for line in (lines) do
            yield (line.Split([| ":" |], StringSplitOptions.RemoveEmptyEntries)).[0]
    }

should get the parens in (lines) removed.

Replace `foo[]` with `array<foo>`

Test1:

let foo (bar: string[]) =
    ()

should become:

let foo (bar: array<string>) =
    ()

Test2:

let foo = []

should become (same):

let foo = []

(should not change)

Vanity alignment when using operator <|

Issue created from fantomas-online

Code

[<AutoOpen>]
module KeyExtensions =
    type PerCommitmentPoint with
        member this.DerivePaymentPrivKey
            (paymentBasepointSecret: PaymentBasepointSecret)
            (channelType: ChannelType)
            (isRemoteKey: bool)
            : PaymentPrivKey =
            PaymentPrivKey
            <| match channelType, isRemoteKey with
               | ChannelType.StaticRemoteKey, true ->
                   paymentBasepointSecret.RawKey()
               | _ -> this.DerivePrivKey(paymentBasepointSecret.RawKey())

Result

[<AutoOpen>]
module KeyExtensions =
    type PerCommitmentPoint with

        member this.DerivePaymentPrivKey
            (paymentBasepointSecret: PaymentBasepointSecret)
            (channelType: ChannelType)
            (isRemoteKey: bool)
            : PaymentPrivKey =
            PaymentPrivKey
            <| match channelType, isRemoteKey with
               | ChannelType.StaticRemoteKey, true -> paymentBasepointSecret.RawKey()
               | _ -> this.DerivePrivKey(paymentBasepointSecret.RawKey())

Expected Result?

[<AutoOpen>]
module KeyExtensions =
    type PerCommitmentPoint with

        member this.DerivePaymentPrivKey
            (paymentBasepointSecret: PaymentBasepointSecret)
            (channelType: ChannelType)
            (isRemoteKey: bool)
            : PaymentPrivKey =
            PaymentPrivKey
            <| match channelType, isRemoteKey with
                | ChannelType.StaticRemoteKey, true -> paymentBasepointSecret.RawKey()
                | _ -> this.DerivePrivKey(paymentBasepointSecret.RawKey())

Problem description

Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.

Extra information

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

Options

Fantomas master branch at 2022-08-21T14:18:45Z - e68e223

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

Too many parentheses

let private GrabTheFirstStringBeforeTheFirstColon (lines: seq<string>) =
    seq {
        for line in (lines) do
            yield (line.Split([| ":" |], StringSplitOptions.RemoveEmptyEntries)).[0]
    }

Ends up with "yield((..."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.