Skip to content

Commit

Permalink
Update Fantomas and FSharpLint. (#1846)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Jul 30, 2021
1 parent 34409b2 commit 2fcb03a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
Expand Down
7 changes: 2 additions & 5 deletions src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
12 changes: 6 additions & 6 deletions src/Fantomas.CoreGlobalTool/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type InputPath =
type OutputPath =
| IO of string
| StdOut
| Notknown
| NotKnown

let isInExcludedDir (fullPath: string) =
set [| "obj"
Expand Down Expand Up @@ -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 =
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/FsUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
[<System.Obsolete>]
let not x = not' x
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/TokenParserBoolExprTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open FsCheck

let getDefineExprs source =
String.normalizeNewLine source
|> TokenParser.getDefines
|> getDefines
|> snd
|> getDefineExprs

Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Tests/UtilsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas/Utils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 ->
Expand Down

0 comments on commit 2fcb03a

Please sign in to comment.