Skip to content

Commit ec3aa5b

Browse files
committed
Make code style consistent with the latest Fantomas settings
1 parent feb7db8 commit ec3aa5b

File tree

287 files changed

+17186
-12844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

287 files changed

+17186
-12844
lines changed

.editorconfig

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,28 @@ indent_size = 4
7474
# Either crlf | lf, default is system-dependent (when not specified at all)
7575
# end_of_line=crlf
7676

77+
# false: let a = [1;2;3]
78+
# true: let a = [ 1;2;3 ]
79+
# default true
80+
fsharp_space_around_delimiter=true
7781

82+
# breaks a single-line record declaration
83+
# i.e. if this gets too wide: { X = 10; Y = 12 }
84+
# default 40
85+
fsharp_max_record_width=60
86+
87+
# breaks a record into one item per line if items exceed this number
88+
# i.e. if set to 1, this will be on three lines: { X = 10; Y = 12 }
89+
# requires fsharp_record_multiline_formatter=number_of_items to take effect
90+
# default 1
91+
fsharp_max_record_number_of_items=1
92+
93+
# whether to use line-length (by counting chars) or items (by counting fields)
94+
# for the record settings above
95+
# either number_of_items or character_width
96+
# default character_width
97+
fsharp_record_multiline_formatter=character_width
98+
99+
# set maximal number of consecutive blank lines to keep from original source
100+
# it doesn't change number of new blank lines generated by Fantomas
101+
fsharp_keep_max_number_of_blank_lines=2

build.fsx

Lines changed: 93 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ let releaseSecret replacement name =
111111
match getVarOrDefaultFromVault name "default_unset" with
112112
| "default_unset" -> failwithf "variable '%s' is not set" name
113113
| s -> s
114+
114115
if BuildServer.buildServer <> BuildServer.TeamFoundation then
115116
// on TFS/VSTS the build will take care of this.
116117
TraceSecrets.register replacement env
118+
117119
env
118120

119121
secrets <- secret :: secrets
@@ -130,10 +132,12 @@ let chocoSource =
130132
getVarOrDefaultFromVault "CHOCO_SOURCE" "https://push.chocolatey.org/"
131133

132134
let artifactsDir = getVarOrDefaultFromVault "ARTIFACTS_DIRECTORY" ""
135+
133136
let docsDomain =
134137
match BuildServer.isLocalBuild with
135138
| true -> "http://127.0.0.1:8083/"
136139
| false -> getVarOrDefaultFromVault "DOCS_DOMAIN" "fake.build"
140+
137141
let fromArtifacts = not <| String.isNullOrEmpty artifactsDir
138142
let apiKey = releaseSecret "<nugetkey>" "NUGET_KEY"
139143
let chocoKey = releaseSecret "<chocokey>" "CHOCOLATEY_API_KEY"
@@ -209,7 +213,9 @@ let version =
209213

210214
let d = System.DateTime.Now
211215
let newLocalVersionNumber = currentVer + 1I
212-
[ PreReleaseSegment.AlphaNumeric("local." + newLocalVersionNumber.ToString()) ], d.ToString("yyyy-MM-dd-HH-mm")
216+
217+
[ PreReleaseSegment.AlphaNumeric("local." + newLocalVersionNumber.ToString()) ],
218+
d.ToString("yyyy-MM-dd-HH-mm")
213219

214220
let semVer = SemVer.parse release.NugetVersion
215221

@@ -220,11 +226,7 @@ let version =
220226

221227
match String.IsNullOrWhiteSpace toAdd with
222228
| true -> None
223-
| false ->
224-
Some
225-
{ Name = ""
226-
Values = source
227-
Origin = toAdd }
229+
| false -> Some { Name = ""; Values = source; Origin = toAdd }
228230
| Some p ->
229231
let toAdd = String.Join(".", source |> Seq.map segToString)
230232
let toAdd = if String.IsNullOrEmpty toAdd then toAdd else "." + toAdd
@@ -450,9 +452,14 @@ let rec nugetPush tries nugetPackage =
450452
try
451453
if not <| String.IsNullOrEmpty apiKey.Value then
452454
let quoteString str = sprintf "\"%s\"" str
453-
454-
let args = sprintf "push %s %s -Source %s" (quoteString nugetPackage) (quoteString apiKey.Value) (quoteString nugetSource)
455-
455+
456+
let args =
457+
sprintf
458+
"push %s %s -Source %s"
459+
(quoteString nugetPackage)
460+
(quoteString apiKey.Value)
461+
(quoteString nugetSource)
462+
456463
let errors = System.Collections.Generic.List<string>()
457464
let results = System.Collections.Generic.List<string>()
458465

@@ -470,22 +477,24 @@ let rec nugetPush tries nugetPackage =
470477
|> CreateProcess.redirectOutput
471478
|> CreateProcess.withOutputEventsNotNull errorF messageF
472479
|> Proc.run
473-
480+
474481
if processResult.ExitCode <> 0 then
475482
if
476483
not ignore_conflict
477484
|| not (errors |> Seq.exists (fun err -> err.Contains "409"))
478485
then
479486
let msgs =
480-
errors |> Seq.map (fun c -> "(Err) " + c)
481-
|> Seq.append results |> Seq.map (fun c -> c)
487+
errors
488+
|> Seq.map (fun c -> "(Err) " + c)
489+
|> Seq.append results
490+
|> Seq.map (fun c -> c)
482491

483492
let msg = String.Join("\n", msgs)
484493

485494
failwithf "failed to push package %s (code %d): \n%s" nugetPackage processResult.ExitCode msg
486495
else
487496
Trace.traceFAKE "ignore conflict error because IGNORE_CONFLICT=true!"
488-
497+
489498
else
490499
Trace.traceFAKE "could not push '%s', because api key was not set" nugetPackage
491500
with exn when tries > 1 ->
@@ -521,9 +530,7 @@ Target.create "Clean" (fun _ ->
521530
Shell.rm ("paket-files" </> "paket.restore.cached")
522531
callPaket "." "restore"
523532

524-
Shell.cleanDirs
525-
[ nugetDncDir
526-
collectedArtifactsDir ]
533+
Shell.cleanDirs [ nugetDncDir; collectedArtifactsDir ]
527534

528535
// Clean Data for tests
529536
cleanForTests ())
@@ -533,7 +540,9 @@ Target.create "CheckReleaseSecrets" (fun _ ->
533540
secret.Force() |> ignore)
534541

535542
Target.create "CheckFormatting" (fun _ ->
536-
let dotnetOptions = (fun (buildOptions:DotNet.Options) -> { buildOptions with RedirectOutput = false})
543+
let dotnetOptions =
544+
(fun (buildOptions: DotNet.Options) -> { buildOptions with RedirectOutput = false })
545+
537546
let result =
538547
DotNet.exec id "fantomas" "src/app/ src/template/ src/test/ --check"
539548

@@ -543,23 +552,22 @@ Target.create "CheckFormatting" (fun _ ->
543552
failwith
544553
"Some files need formatting, please run \"dotnet fantomas src/app/ src/template/ src/test/\" to resolve this."
545554
else
546-
failwith "Errors while formatting"
547-
)
555+
failwith "Errors while formatting")
548556

549557
// ----------------------------------------------------------------------------------------------------
550558
// Documentation targets.
551559

552560
Target.create "GenerateDocs" (fun _ ->
553561
let source = "./docs"
554-
562+
555563
Shell.cleanDir ".fsdocs"
556564
Directory.ensure "output"
557565

558566
let projInfo =
559567
seq {
560-
("root", docsDomain)
561-
("fsdocs-logo-src", docsDomain @@ "content/img/logo.svg")
562-
("fsdocs-fake-version", simpleVersion)
568+
("root", docsDomain)
569+
("fsdocs-logo-src", docsDomain @@ "content/img/logo.svg")
570+
("fsdocs-fake-version", simpleVersion)
563571
}
564572

565573
File.writeString false "./output/.nojekyll" ""
@@ -568,26 +576,31 @@ Target.create "GenerateDocs" (fun _ ->
568576

569577
try
570578
Npm.install (fun o -> { o with WorkingDirectory = "./docs" })
571-
579+
572580
Npm.run "build" (fun o -> { o with WorkingDirectory = "./docs" })
573581

574-
Shell.copy "./output" [source </> "robots.txt"]
582+
Shell.copy "./output" [ source </> "robots.txt" ]
575583

576584
// renaming node_modules directory so that fsdocs skip it when generating site.
577585
Directory.Move("./docs/node_modules", "./docs/.node_modules")
578586

579-
let command = sprintf "build --clean --input ./docs --saveimages --properties Configuration=release --parameters fsdocs-logo-src %s fsdocs-fake-version %s" (docsDomain @@ "content/img/logo.svg") simpleVersion
587+
let command =
588+
sprintf
589+
"build --clean --input ./docs --saveimages --properties Configuration=release --parameters fsdocs-logo-src %s fsdocs-fake-version %s"
590+
(docsDomain @@ "content/img/logo.svg")
591+
simpleVersion
592+
580593
DotNet.exec id "fsdocs" command |> ignore
581594

582-
// Fsdocs.build (fun p -> { p with
583-
// Input = Some(source)
584-
// SaveImages = Some(true)
585-
// Clean = Some(true)
586-
// Parameters = Some projInfo
587-
// Properties = Some "Configuration=debug"
588-
// //Strict = Some(true)
589-
// })
590-
595+
// Fsdocs.build (fun p -> { p with
596+
// Input = Some(source)
597+
// SaveImages = Some(true)
598+
// Clean = Some(true)
599+
// Parameters = Some projInfo
600+
// Properties = Some "Configuration=debug"
601+
// //Strict = Some(true)
602+
// })
603+
591604
finally
592605
// clean up
593606
Shell.rm (source </> "guide/RELEASE_NOTES.md")
@@ -597,19 +610,31 @@ Target.create "GenerateDocs" (fun _ ->
597610

598611

599612
// validate site generation and ensure all components are generated successfully.
600-
if DirectoryInfo.ofPath("./output/guide").GetFiles().Length = 0 then failwith "site generation failed due to missing guide directory"
601-
if DirectoryInfo.ofPath("./output/reference").GetFiles().Length = 0 then failwith "site generation failed due to missing reference directory"
602-
if DirectoryInfo.ofPath("./output/articles").GetFiles().Length = 0 then failwith "site generation failed due to missing articles directory"
603-
if not (File.exists("./output/data.json")) then failwith "site generation failed due to missing data.json file"
604-
if not (File.exists("./output/guide/RELEASE_NOTES.html")) then failwith "site generation failed due to missing RELEASE_NOTES.html file"
605-
if not (File.exists("./output/guide.html")) then failwith "site generation failed due to missing guide.html file"
606-
if not (File.exists("./output/index.html")) then failwith "site generation failed due to missing index.html file"
613+
if DirectoryInfo.ofPath("./output/guide").GetFiles().Length = 0 then
614+
failwith "site generation failed due to missing guide directory"
615+
616+
if DirectoryInfo.ofPath("./output/reference").GetFiles().Length = 0 then
617+
failwith "site generation failed due to missing reference directory"
618+
619+
if DirectoryInfo.ofPath("./output/articles").GetFiles().Length = 0 then
620+
failwith "site generation failed due to missing articles directory"
621+
622+
if not (File.exists ("./output/data.json")) then
623+
failwith "site generation failed due to missing data.json file"
624+
625+
if not (File.exists ("./output/guide/RELEASE_NOTES.html")) then
626+
failwith "site generation failed due to missing RELEASE_NOTES.html file"
627+
628+
if not (File.exists ("./output/guide.html")) then
629+
failwith "site generation failed due to missing guide.html file"
630+
631+
if not (File.exists ("./output/index.html")) then
632+
failwith "site generation failed due to missing index.html file"
607633

608634
// prepare artifact
609635
Directory.ensure "temp"
610-
611-
!!("output" </> "**/*")
612-
|> Zip.zip docsDir "temp/docs.zip"
636+
637+
!!("output" </> "**/*") |> Zip.zip docsDir "temp/docs.zip"
613638
publish "temp/docs.zip")
614639

615640
Target.create "HostDocs" (fun _ ->
@@ -622,23 +647,28 @@ Target.create "HostDocs" (fun _ ->
622647

623648
Shell.copy (source @@ "guide") [ "RELEASE_NOTES.md" ]
624649

625-
Shell.copy "./output" [source </> "robots.txt"]
626-
650+
Shell.copy "./output" [ source </> "robots.txt" ]
651+
627652
// renaming node_modules directory so that fsdocs skip it when generating site.
628653
Directory.Move("./docs/node_modules", "./docs/.node_modules")
629654

630-
let command = sprintf "watch --input ./docs --saveimages --properties Configuration=release --parameters fsdocs-logo-src %s fsdocs-fake-version %s" (docsDomain @@ "content/img/logo.svg") simpleVersion
655+
let command =
656+
sprintf
657+
"watch --input ./docs --saveimages --properties Configuration=release --parameters fsdocs-logo-src %s fsdocs-fake-version %s"
658+
(docsDomain @@ "content/img/logo.svg")
659+
simpleVersion
660+
631661
DotNet.exec id "fsdocs" command |> ignore
632662

633-
// Fsdocs.watch id
663+
// Fsdocs.watch id
634664

635665
finally
636666
// clean up
637667
Shell.rm (source </> "guide/RELEASE_NOTES.md")
638668

639669
// renaming node_modules directory back after fsdocs generated site.
640670
Directory.Move("./docs/.node_modules", "./docs/node_modules")
641-
671+
642672
)
643673

644674
// ----------------------------------------------------------------------------------------------------
@@ -659,7 +689,7 @@ Target.create "TemplateIntegrationTests" (fun _ ->
659689
targetDir
660690
"bin/Release/net6.0/Fake.DotNet.Cli.IntegrationTests.dll"
661691
"Fake_DotNet_Cli_IntegrationTests.TestResults.xml"
662-
692+
663693
Shell.rm_rf (root </> "test"))
664694

665695
Target.create "DotNetCoreUnitTests" (fun _ ->
@@ -723,14 +753,16 @@ Target.create "BootstrapFake" (fun _ ->
723753

724754

725755
let processResult =
726-
CreateProcess.fromRawCommandLine fileName (sprintf "run --fsiargs \"--define:BOOTSTRAP\" %s --target %s" script target)
756+
CreateProcess.fromRawCommandLine
757+
fileName
758+
(sprintf "run --fsiargs \"--define:BOOTSTRAP\" %s --target %s" script target)
727759
|> CreateProcess.withWorkingDirectory "."
728760
|> CreateProcess.setEnvironmentVariable "FAKE_DETAILED_ERRORS" "true"
729761
|> CreateProcess.withTimeout timeout
730762
|> Proc.run
731-
763+
732764
processResult.ExitCode
733-
765+
734766
let result = executeTarget "BootstrapFake_PrintColors"
735767

736768
if result <> 0 then
@@ -967,11 +999,7 @@ Target.create "DotNetPushChocolateyPackage" (fun _ ->
967999
{ p with ToolPath = altToolPath }
9681000

9691001
path
970-
|> Choco.push (fun p ->
971-
{ p with
972-
Source = chocoSource
973-
ApiKey = chocoKey.Value }
974-
|> changeToolPath))
1002+
|> Choco.push (fun p -> { p with Source = chocoSource; ApiKey = chocoKey.Value } |> changeToolPath))
9751003

9761004
Target.create "DotNetPushToNuGet" (fun _ ->
9771005
!!(appDir </> "*/*.fsproj") -- (appDir </> "Fake.netcore/*.fsproj")
@@ -1031,7 +1059,7 @@ Target.create "GitHubRelease" (fun _ ->
10311059
|> GitHub.uploadFiles files
10321060
|> GitHub.publishDraft
10331061
|> Async.RunSynchronously
1034-
1062+
10351063
let bumpVersionMessage = (sprintf "Bump version to %s" simpleVersion)
10361064
let branch = "bump-version-to-" + simpleVersion
10371065
Git.Staging.stageAll ".config"
@@ -1041,9 +1069,12 @@ Target.create "GitHubRelease" (fun _ ->
10411069

10421070
// when we release the GitHub module, this will be replaced with GitHub.createPullRequest API
10431071
let pullRequest = new NewPullRequest(bumpVersionMessage, branch, "master")
1072+
10441073
let pullRequestTask (client: GitHubClient) =
1045-
client.PullRequest.Create(githubReleaseUser, gitName, pullRequest) |> Async.AwaitTask |> Async.RunSynchronously
1046-
1074+
client.PullRequest.Create(githubReleaseUser, gitName, pullRequest)
1075+
|> Async.AwaitTask
1076+
|> Async.RunSynchronously
1077+
10471078
GitHub.createClientWithToken token
10481079
|> Async.RunSynchronously
10491080
|> pullRequestTask

integrationtests/core-context-exists/before/context.exists.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ nuget Fake.Core.Context prerelease"
1010
#load ".fake/context.exists.fsx/intellisense.fsx"
1111

1212
printfn "loading context"
13-
let context = Fake.Core.Context.forceFakeContext()
13+
let context = Fake.Core.Context.forceFakeContext ()
1414
printfn "got: %A" context
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
printfn "Hello FAKE"
1+
printfn "Hello FAKE"
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module OtherFile
22

33
open Fake.Core
4+
45
[<System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)>]
56
let createTargets () =
67

7-
Target.create "OtherFileTarget" (fun _ ->
8-
printfn "Doing Something."
9-
)
8+
Target.create "OtherFileTarget" (fun _ -> printfn "Doing Something.")
109

1110
// required because otherwise JIT is still inlining this :(
12-
printfn "test"
11+
printfn "test"
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
open Fake.Core
22

3-
Target.initEnvironment()
4-
Target.create "OtherScriptTarget" (fun _ ->
5-
printfn "Doing Something."
6-
)
3+
Target.initEnvironment ()
4+
Target.create "OtherScriptTarget" (fun _ -> printfn "Doing Something.")

0 commit comments

Comments
 (0)