nblockchain / fantomless Goto Github PK
View Code? Open in Web Editor NEWThis project forked from fsprojects/fantomas
FSharp source code formatter
Home Page: https://fsprojects.github.io/fantomas-tools/#/fantomas/preview
License: Other
This project forked from fsprojects/fantomas
FSharp source code formatter
Home Page: https://fsprojects.github.io/fantomas-tools/#/fantomas/preview
License: Other
// 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
Test1:
match foo with
| (Bar) -> ()
| _ -> ()
should become:
match foo with
| Bar -> ()
| _ -> ()
Test2:
match foo with
| (Bar baz) -> ()
| _ -> ()
should become:
match foo with
| (Bar baz) -> ()
| _ -> ()
(should not change)
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)
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))
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.
Test1:
let foo (bar: string[]) =
()
should become:
let foo (bar: array<string>) =
()
Test2:
let foo = []
should become (same):
let foo = []
(should not change)
Issue created from fantomas-online
[<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())
[<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())
[<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())
Please describe here the Fantomas problem you encountered.
Check out our Contribution Guidelines.
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?
Test1:
if foo then
()
else if bar then
()
should become:
if foo then
()
elif bar then
()
Test2:
if foo then
()
else
if bar then
()
else
()
should become (same):
if foo then
()
else
if bar then
()
else
()
(should not change)
let private GrabTheFirstStringBeforeTheFirstColon (lines: seq<string>) =
seq {
for line in (lines) do
yield (line.Split([| ":" |], StringSplitOptions.RemoveEmptyEntries)).[0]
}
Ends up with "yield((..."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.