Skip to content

Commit 7e63a41

Browse files
authored
Update git pre-push check. (#2345)
1 parent 6e8f236 commit 7e63a41

File tree

3 files changed

+5
-20
lines changed

3 files changed

+5
-20
lines changed

.fantomasignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
obj/**/*.fs
2+
src/Fantomas.FCS/generated

.githooks/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ remote_url="$2"
1717

1818
# ensure that formatting is correct before pushing to the remote repository
1919
dotnet tool restore
20-
dotnet fake build -t CheckFormat
20+
dotnet fantomas -r src docs/.style/ build.fsx

build.fsx

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ let configuration = DotNet.BuildConfiguration.Release
1616
let solutionFile = "fantomas.sln"
1717
//// Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
1818

19-
// Files to format
20-
let sourceFiles =
21-
!! "src/**/*.fs"
22-
++ "src/**/*.fsi"
23-
++ "build.fsx"
24-
++ "docs/**/*.fsx"
25-
-- "src/**/obj/**/*.fs"
26-
-- "src/Fantomas.FCS/generated/netstandard2.0/*.*"
27-
2819
// Types and helper functions for building external projects (see the TestExternalProjects target below)
2920
type ProcessStartInfo =
3021
{ ProcessName: string
@@ -300,11 +291,7 @@ Target.create "Benchmark" (fun _ ->
300291
)
301292

302293
Target.create "Format" (fun _ ->
303-
let result =
304-
sourceFiles
305-
|> Seq.map (sprintf "\"%s\"")
306-
|> String.concat " "
307-
|> DotNet.exec id "fantomas"
294+
let result = DotNet.exec id "fantomas" "--recurse src docs/.style/ build.fsx"
308295

309296
if not result.OK then
310297
printfn "Errors while formatting all files: %A" result.Messages)
@@ -330,11 +317,7 @@ Target.create "FormatChanged" (fun _ ->
330317

331318
Target.create "CheckFormat" (fun _ ->
332319
let result =
333-
sourceFiles
334-
|> Seq.map (sprintf "\"%s\"")
335-
|> String.concat " "
336-
|> sprintf "%s --check"
337-
|> DotNet.exec id "fantomas"
320+
DotNet.exec id "fantomas" "--check --recurse src docs/.style/ build.fsx"
338321

339322
if result.ExitCode = 0 then
340323
Trace.log "No files need formatting"

0 commit comments

Comments
 (0)