From 2fcb03a1caa824c95547c824a0377e2fc477a7c3 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Fri, 30 Jul 2021 09:19:29 +0200 Subject: [PATCH] Update Fantomas and FSharpLint. (#1846) --- .config/dotnet-tools.json | 4 ++-- src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs | 7 ++----- src/Fantomas.CoreGlobalTool/Program.fs | 12 ++++++------ src/Fantomas.Tests/FsUnit.fs | 2 +- src/Fantomas.Tests/TokenParserBoolExprTests.fs | 2 +- src/Fantomas.Tests/UtilsTests.fs | 6 +++--- src/Fantomas/Utils.fs | 4 ++-- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 43666ea4cd..821ff48b92 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,13 +15,13 @@ ] }, "dotnet-fsharplint": { - "version": "0.18.0", + "version": "0.19.2", "commands": [ "dotnet-fsharplint" ] }, "fantomas-tool": { - "version": "4.5.0", + "version": "4.5.1", "commands": [ "fantomas" ] diff --git a/src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs b/src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs index 9bfc2723a6..f6e0486c0b 100644 --- a/src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs +++ b/src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs @@ -91,7 +91,7 @@ let ``check with multiple files`` () = exitCode |> should equal 99 let needsFormatting = - sprintf "%s needs formatting" (System.IO.Path.GetFileName(fileFixtureOne.Filename)) + sprintf "%s needs formatting" (Path.GetFileName(fileFixtureOne.Filename)) output |> should contain needsFormatting @@ -109,10 +109,7 @@ let ``check with file and folder`` () = exitCode |> should equal 99 let needsFormatting = - sprintf - "sub%c%s needs formatting" - System.IO.Path.DirectorySeparatorChar - (System.IO.Path.GetFileName(fileFixtureOne.Filename)) + sprintf "sub%c%s needs formatting" Path.DirectorySeparatorChar (Path.GetFileName(fileFixtureOne.Filename)) output |> should contain needsFormatting diff --git a/src/Fantomas.CoreGlobalTool/Program.fs b/src/Fantomas.CoreGlobalTool/Program.fs index 0544081234..7c4d7e2041 100644 --- a/src/Fantomas.CoreGlobalTool/Program.fs +++ b/src/Fantomas.CoreGlobalTool/Program.fs @@ -63,7 +63,7 @@ type InputPath = type OutputPath = | IO of string | StdOut - | Notknown + | NotKnown let isInExcludedDir (fullPath: string) = set [| "obj" @@ -251,7 +251,7 @@ let main argv = else match results.TryGetResult <@ Arguments.Out @> with | Some output -> OutputPath.IO output - | None -> OutputPath.Notknown + | None -> OutputPath.NotKnown let inputPath = let maybeInput = @@ -445,12 +445,12 @@ let main argv = eprintfn "Input path is missing..." exit 1 | InputPath.File f, _ when (IgnoreFile.isIgnoredFile f) -> printfn "'%s' was ignored" f - | InputPath.Folder p1, OutputPath.Notknown -> processFolder p1 p1 - | InputPath.File p1, OutputPath.Notknown -> processFile p1 p1 + | InputPath.Folder p1, OutputPath.NotKnown -> processFolder p1 p1 + | InputPath.File p1, OutputPath.NotKnown -> processFile p1 p1 | InputPath.File p1, OutputPath.IO p2 -> processFile p1 p2 | InputPath.Folder p1, OutputPath.IO p2 -> processFolder p1 p2 | InputPath.StdIn s, OutputPath.IO p -> stringToFile s p FormatConfig.Default - | InputPath.StdIn s, OutputPath.Notknown + | InputPath.StdIn s, OutputPath.NotKnown | InputPath.StdIn s, OutputPath.StdOut -> stringToStdOut s FormatConfig.Default | InputPath.File p, OutputPath.StdOut -> fileToStdOut p | InputPath.Folder p, OutputPath.StdOut -> allFiles recurse p |> Seq.iter fileToStdOut @@ -459,7 +459,7 @@ let main argv = | OutputPath.IO _) -> eprintfn "--stdout and --out cannot be combined with multiple files." exit 1 - | InputPath.Multiple (files, folders), OutputPath.Notknown -> filesAndFolders files folders + | InputPath.Multiple (files, folders), OutputPath.NotKnown -> filesAndFolders files folders with | exn -> printfn "%s" exn.Message diff --git a/src/Fantomas.Tests/FsUnit.fs b/src/Fantomas.Tests/FsUnit.fs index 4748651242..a5d9cb7be4 100644 --- a/src/Fantomas.Tests/FsUnit.fs +++ b/src/Fantomas.Tests/FsUnit.fs @@ -77,6 +77,6 @@ module TopLevelOperators = let not' x = NotConstraint(x) /// Deprecated operators. These will be removed in a future version of FsUnit. - module FsUnitDepricated = + module FsUnitDeprecated = [] let not x = not' x diff --git a/src/Fantomas.Tests/TokenParserBoolExprTests.fs b/src/Fantomas.Tests/TokenParserBoolExprTests.fs index 0115d1cfc7..a8d4f0357f 100644 --- a/src/Fantomas.Tests/TokenParserBoolExprTests.fs +++ b/src/Fantomas.Tests/TokenParserBoolExprTests.fs @@ -10,7 +10,7 @@ open FsCheck let getDefineExprs source = String.normalizeNewLine source - |> TokenParser.getDefines + |> getDefines |> snd |> getDefineExprs diff --git a/src/Fantomas.Tests/UtilsTests.fs b/src/Fantomas.Tests/UtilsTests.fs index e14c99cfb1..725df4cf3e 100644 --- a/src/Fantomas.Tests/UtilsTests.fs +++ b/src/Fantomas.Tests/UtilsTests.fs @@ -118,7 +118,7 @@ SetupTesting.generateSetupScript __SOURCE_DIRECTORY__ let ``when input is empty`` () = let property (p: bool) : bool = let before, after = List.partitionWhile (fun _ _ -> p) [] - before = [] && after = [] + List.isEmpty before && List.isEmpty after Check.QuickThrowOnFailure property @@ -128,7 +128,7 @@ let ``when predicate always returns false`` () = let before, after = List.partitionWhile (fun _ _ -> false) xs - before = [] && after = xs + List.isEmpty before && after = xs Check.QuickThrowOnFailure property @@ -138,7 +138,7 @@ let ``when predicate always returns true`` () = let before, after = List.partitionWhile (fun _ _ -> true) xs - before = xs && after = [] + before = xs && List.isEmpty after Check.QuickThrowOnFailure property diff --git a/src/Fantomas/Utils.fs b/src/Fantomas/Utils.fs index a4f17b3a51..8e2e2e9926 100644 --- a/src/Fantomas/Utils.fs +++ b/src/Fantomas/Utils.fs @@ -68,7 +68,7 @@ module String = failwithf """Fantomas is trying to format the input multiple times due to the detect of multiple defines. -There is a problem with merging all the code back togheter. Please raise an issue at https://github.com/fsprojects/fantomas/issues.""" +There is a problem with merging all the code back together. Please raise an issue at https://github.com/fsprojects/fantomas/issues.""" List.zip aChunks bChunks |> List.map @@ -152,7 +152,7 @@ module List = | [ _ ] -> false | _ -> true - let partitionWhile (f: int -> 'a -> bool) (xs: 'a list) : ('a list * 'a list) = + let partitionWhile (f: int -> 'a -> bool) (xs: 'a list) : 'a list * 'a list = let rec go i before after = match after with | head :: tail ->