Skip to content

Commit 536db14

Browse files
authored
Merge pull request #34 from jkone27/add-fantomas
Add fantomas
2 parents ed93b72 + a49d8ae commit 536db14

18 files changed

+490
-448
lines changed

.config/dotnet-tools.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
"version": "6.0.5",
77
"commands": [
88
"fantomas"
9-
]
9+
],
10+
"rollForward": false
11+
},
12+
"husky": {
13+
"version": "0.7.2",
14+
"commands": [
15+
"husky"
16+
],
17+
"rollForward": false
1018
}
1119
}
1220
}

.husky/pre-commit

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
## husky task runner examples -------------------
5+
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
6+
7+
## run all tasks
8+
#husky run
9+
10+
### run all tasks with group: 'group-name'
11+
#husky run --group group-name
12+
13+
## run task with name: 'task-name'
14+
#husky run --name task-name
15+
16+
## pass hook arguments to task
17+
#husky run --args "$1" "$2"
18+
19+
## or put your custom commands -------------------
20+
#echo 'Husky.Net is awesome!'
21+
22+
dotnet husky run --group pre-commit

.husky/task-runner.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
3+
"tasks": [
4+
{
5+
"name": "fantomas-format-staged-files",
6+
"group": "pre-commit",
7+
"command": "dotnet",
8+
"args": [
9+
"fantomas",
10+
"${staged}"
11+
],
12+
"include": [
13+
"**/*.fs",
14+
"**/*.fsx",
15+
"**/*.fsi"
16+
]
17+
}
18+
]
19+
}

ApiStub.FSharp.Stubbery/Library.fs

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,55 +36,51 @@ module StubberyCE =
3636
stubbery
3737
.Request(methods)
3838
.IfRoute(route)
39-
.Response(fun r args -> stub r args |> box) |> ignore
39+
.Response(fun r args -> stub r args |> box)
40+
|> ignore
41+
4042
this
4143

4244
[<CustomOperation("stub_obj")>]
43-
member this.StubObj(x, methods, route, stub : unit -> obj) =
44-
this.Stub(x, methods, route, fun _ _ -> stub())
45+
member this.StubObj(x, methods, route, stub: unit -> obj) =
46+
this.Stub(x, methods, route, (fun _ _ -> stub ()))
4547

4648
[<CustomOperation("GET")>]
4749
member this.Get(x, route, stub) =
48-
this.Stub(x, [|HttpMethod.Get|], route, stub)
50+
this.Stub(x, [| HttpMethod.Get |], route, stub)
4951

5052
[<CustomOperation("GET_OBJ")>]
5153
member this.GetObj(x, route, stub) =
52-
this.StubObj(x, [|HttpMethod.Get|], route, fun _ -> stub)
54+
this.StubObj(x, [| HttpMethod.Get |], route, (fun _ -> stub))
5355

5456
[<CustomOperation("POST")>]
5557
member this.Post(x, route, stub) =
56-
this.Stub(x, [|HttpMethod.Post|], route, stub)
58+
this.Stub(x, [| HttpMethod.Post |], route, stub)
5759

5860
[<CustomOperation("POST_OBJ")>]
5961
member this.PostObj(x, route, stub) =
60-
this.StubObj(x, [|HttpMethod.Post|], route, fun _ -> stub)
62+
this.StubObj(x, [| HttpMethod.Post |], route, (fun _ -> stub))
6163

6264
[<CustomOperation("PUT")>]
6365
member this.Put(x, route, stub) =
64-
this.Stub(x, [|HttpMethod.Put|], route, stub)
66+
this.Stub(x, [| HttpMethod.Put |], route, stub)
6567

6668
[<CustomOperation("DELETE")>]
6769
member this.Delete(x, route, stub) =
68-
this.Stub(x, [|HttpMethod.Delete|], route, stub)
70+
this.Stub(x, [| HttpMethod.Delete |], route, stub)
6971

7072
member this.GetFactory() =
7173
let clientBuilder =
7274
factory
7375
|> web_configure_services (fun s ->
7476
s.ConfigureAll<HttpClientFactoryOptions>(fun options ->
75-
options.HttpClientActions.Add(fun c ->
76-
c.BaseAddress <- uri.MockUri
77-
)
78-
)
79-
)
77+
options.HttpClientActions.Add(fun c -> c.BaseAddress <- uri.MockUri)))
8078

8179
stubbery.Start()
8280
uri.MockUri <- new Uri(stubbery.Address)
8381
clientBuilder
8482

85-
interface IDisposable
86-
with member this.Dispose() =
87-
factory.Dispose()
88-
stubbery.Dispose()
89-
90-
83+
interface IDisposable with
84+
member this.Dispose() =
85+
factory.Dispose()
86+
stubbery.Dispose()
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFramework>net6.0</TargetFramework>
5-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
6-
<PackageId>ApiStub.FSharp</PackageId>
7-
<Version>1.0.2</Version>
8-
<Authors>jkone27</Authors>
9-
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
10-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11-
<PackageTags>Aspnet;Testing;Integration Testing;dotnet;Stub</PackageTags>
12-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
13-
<RepositoryUrl>https://github.com/jkone27/fsharp-integration-tests.git</RepositoryUrl>
14-
<RepositoryType>git</RepositoryType>
15-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
16-
<IncludeSymbols>true</IncludeSymbols>
17-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
18-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
19-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
20-
<EnablePackageValidation>true</EnablePackageValidation>
21-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
22-
<OutputType>Library</OutputType>
23-
</PropertyGroup>
24-
25-
<ItemGroup>
26-
<Compile Include="BuilderExtensions.fs" />
27-
<Compile Include="HttpResponseHelpers.fs" />
28-
<Compile Include="DelegatingHandlers.fs" />
29-
<Compile Include="CE.fs" />
30-
<Compile Include="BDD.fs" />
31-
</ItemGroup>
32-
33-
<ItemGroup>
34-
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.3">
35-
<GeneratePathProperty></GeneratePathProperty>
36-
</PackageReference>
37-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
38-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
39-
</ItemGroup>
40-
41-
<ItemGroup>
42-
<PackageReference Update="FSharp.Core" Version="6.0.3" />
43-
</ItemGroup>
44-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net6.0</TargetFramework>
4+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
5+
<PackageId>ApiStub.FSharp</PackageId>
6+
<Version>1.0.2</Version>
7+
<Authors>jkone27</Authors>
8+
<RequireLicenseAcceptance>false</RequireLicenseAcceptance>
9+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10+
<PackageTags>Aspnet;Testing;Integration Testing;dotnet;Stub</PackageTags>
11+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12+
<RepositoryUrl>https://github.com/jkone27/fsharp-integration-tests.git</RepositoryUrl>
13+
<RepositoryType>git</RepositoryType>
14+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
15+
<IncludeSymbols>true</IncludeSymbols>
16+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
17+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
18+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
19+
<EnablePackageValidation>true</EnablePackageValidation>
20+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
21+
<OutputType>Library</OutputType>
22+
</PropertyGroup>
23+
<ItemGroup>
24+
<Compile Include="BuilderExtensions.fs" />
25+
<Compile Include="HttpResponseHelpers.fs" />
26+
<Compile Include="DelegatingHandlers.fs" />
27+
<Compile Include="CE.fs" />
28+
<Compile Include="BDD.fs" />
29+
</ItemGroup>
30+
<ItemGroup>
31+
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.3">
32+
<GeneratePathProperty></GeneratePathProperty>
33+
</PackageReference>
34+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
35+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<PackageReference Update="FSharp.Core" Version="6.0.3" />
39+
</ItemGroup>
40+
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
41+
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
42+
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory=".." />
43+
</Target>
44+
</Project>

0 commit comments

Comments
 (0)