Skip to content

Commit

Permalink
Remove unused parenthesis. (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Apr 10, 2021
1 parent 8b0920d commit b333fba
Show file tree
Hide file tree
Showing 46 changed files with 493 additions and 496 deletions.
4 changes: 2 additions & 2 deletions src/Fantomas.CoreGlobalTool.Tests/ByteOrderMarkTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let ``byte-order mark should be preserved, 795`` () =
use fileFixture =
new TemporaryFileCodeSample(Source, true)

let (exitCode, _) = runFantomasTool fileFixture.Filename
let exitCode, _ = runFantomasTool fileFixture.Filename
exitCode |> should equal 0

let expectedPreamble = Encoding.UTF8.GetPreamble()
Expand All @@ -36,7 +36,7 @@ let ``preserve byte-order from original file`` () =

use outputFixture = new OutputFile()

let (exitCode, _) =
let exitCode, _ =
sprintf "--out %s %s" outputFixture.Filename inputFixture.Filename
|> runFantomasTool

Expand Down
10 changes: 5 additions & 5 deletions src/Fantomas.CoreGlobalTool.Tests/CheckTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ let ``formatted files should report exit code 0`` () =
use fileFixture =
new TemporaryFileCodeSample(CorrectlyFormatted)

let (exitCode, _) = checkCode fileFixture.Filename
let exitCode, _ = checkCode fileFixture.Filename
exitCode |> should equal 0

[<Test>]
let ``invalid files should report exit code 1`` () =
use fileFixture = new TemporaryFileCodeSample(WithErrors)
let (exitCode, _) = checkCode fileFixture.Filename
let exitCode, _ = checkCode fileFixture.Filename
exitCode |> should equal 1

[<Test>]
let ``files that need formatting should report exit code 99`` () =
use fileFixture =
new TemporaryFileCodeSample(NeedsFormatting)

let (exitCode, _) = checkCode fileFixture.Filename
let exitCode, _ = checkCode fileFixture.Filename
exitCode |> should equal 99

[<Test>]
Expand All @@ -53,7 +53,7 @@ let main _ = 0
use fileFixture =
new TemporaryFileCodeSample(codeSnippet, fileName = "Program")

let (exitCode, _) = checkCode fileFixture.Filename
let exitCode, _ = checkCode fileFixture.Filename
exitCode |> should equal 0

[<Test>]
Expand All @@ -73,5 +73,5 @@ let ``check with different line endings`` () =
use fileFixture =
new TemporaryFileCodeSample(snippetWithOtherLineEndings)

let (exitCode, _) = checkCode fileFixture.Filename
let exitCode, _ = checkCode fileFixture.Filename
exitCode |> should equal 0
4 changes: 2 additions & 2 deletions src/Fantomas.CoreGlobalTool.Tests/ConfigTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ indent_size=2
"""
)

let (exitCode, output) = runFantomasTool fileFixture.Filename
let exitCode, output = runFantomasTool fileFixture.Filename

exitCode |> should equal 0

Expand Down Expand Up @@ -80,7 +80,7 @@ end_of_line = %s
setting
)

let (exitCode, _) = runFantomasTool fileFixture.Filename
let exitCode, _ = runFantomasTool fileFixture.Filename

exitCode |> should equal 0

Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.CoreGlobalTool.Tests/ExitCodeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ let WithErrors = """let a ="""
[<Test>]
let ``invalid files should report exit code 1`` () =
use fileFixture = new TemporaryFileCodeSample(WithErrors)
let (exitCode, _) = formatCode fileFixture.Filename
let exitCode, _ = formatCode fileFixture.Filename
exitCode |> should equal 1
12 changes: 6 additions & 6 deletions src/Fantomas.CoreGlobalTool.Tests/IgnoreFilesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let ``ignore all fs files`` () =
use ignoreFixture = new FantomasIgnoreFile("*.fs")
use outputFixture = new OutputFile()

let (exitCode, _) =
let exitCode, _ =
sprintf "--out %s %s" outputFixture.Filename inputFixture.Filename
|> runFantomasTool

Expand All @@ -36,7 +36,7 @@ let ``ignore specific file`` () =

use ignoreFixture = new FantomasIgnoreFile("A.fs")

let (exitCode, output) = runFantomasTool inputFixture.Filename
let exitCode, output = runFantomasTool inputFixture.Filename
exitCode |> should equal 0

printfn "%s" output
Expand All @@ -52,7 +52,7 @@ let ``don't ignore other files`` () =

use ignoreFixture = new FantomasIgnoreFile("A.fs")

let (exitCode, output) = runFantomasTool inputFixture.Filename
let exitCode, output = runFantomasTool inputFixture.Filename
exitCode |> should equal 0

output |> should contain "Processing"
Expand All @@ -69,7 +69,7 @@ let ``ignore file in folder`` () =

use ignoreFixture = new FantomasIgnoreFile("A.fs")

let (exitCode, _) =
let exitCode, _ =
runFantomasTool (sprintf ".%c%s" Path.DirectorySeparatorChar subFolder)

exitCode |> should equal 0
Expand All @@ -86,7 +86,7 @@ let ``ignore file while checking`` () =

use ignoreFixture = new FantomasIgnoreFile("A.fs")

let (exitCode, output) =
let exitCode, output =
sprintf "%s --check" inputFixture.Filename
|> runFantomasTool

Expand All @@ -104,7 +104,7 @@ let ``ignore file in folder while checking`` () =

use ignoreFixture = new FantomasIgnoreFile("A.fs")

let (exitCode, _) =
let exitCode, _ =
runFantomasTool (sprintf ".%c%s --check" Path.DirectorySeparatorChar subFolder)

exitCode |> should equal 0
Expand Down
8 changes: 4 additions & 4 deletions src/Fantomas.CoreGlobalTool/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let isInExcludedDir (fullPath: string) =
".fable"
"node_modules" |]
|> Set.map (fun dir -> sprintf "%c%s%c" Path.DirectorySeparatorChar dir Path.DirectorySeparatorChar)
|> Set.exists (fullPath.Contains)
|> Set.exists fullPath.Contains

let isFSharpFile (s: string) =
Set.contains (Path.GetExtension s) extensions
Expand All @@ -87,7 +87,7 @@ let rec allFiles isRec path =
(fun f ->
isFSharpFile f
&& not (isInExcludedDir f)
&& not (IgnoreFile.isIgnoredFile (f)))
&& not (IgnoreFile.isIgnoredFile f))

/// Fantomas assumes the input files are UTF-8
/// As is stated in F# language spec: https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf#page=25
Expand Down Expand Up @@ -207,12 +207,12 @@ let runCheckCommand (recurse: bool) (inputPath: InputPath) : int =
| InputPath.File f when (IgnoreFile.isIgnoredFile f) ->
printfn "'%s' was ignored" f
0
| InputPath.File (path) ->
| InputPath.File path ->
path
|> Seq.singleton
|> check
|> processCheckResult
| InputPath.Folder (path) ->
| InputPath.Folder path ->
path
|> allFiles recurse
|> check
Expand Down
8 changes: 4 additions & 4 deletions src/Fantomas.Tests/ActivePatternTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ let (|ParseRegex|_|) regex str =
if m.Success
then Some (List.tail [ for x in m.Groups -> x.Value ])
else None"""
({ config with
MaxValueBindingWidth = 30
MaxFunctionBindingWidth = 30
MaxIfThenElseShortWidth = 70 })
{ config with
MaxValueBindingWidth = 30
MaxFunctionBindingWidth = 30
MaxIfThenElseShortWidth = 70 }
|> prepend newline
|> should
equal
Expand Down
12 changes: 6 additions & 6 deletions src/Fantomas.Tests/AttributeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ module C =
[<DllImport("")>]
extern IntPtr f()
"""
({ config with StrictMode = true })
{ config with StrictMode = true }
|> prepend newline
|> should
equal
Expand All @@ -368,11 +368,11 @@ let main argv =
|> Array.map getJsonNetJson |> Array.iter (printfn "%s")
0 // return an integer exit code
"""
({ config with
SpaceAfterComma = false
SpaceAfterSemicolon = false
SpaceAroundDelimiter = false
SpaceBeforeLowercaseInvocation = false })
{ config with
SpaceAfterComma = false
SpaceAfterSemicolon = false
SpaceAroundDelimiter = false
SpaceBeforeLowercaseInvocation = false }
|> prepend newline
|> should
equal
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ type DerivedClass =
val string2 : string
new (str1, str2) = { inherit BaseClass(str1); string2 = str2 }
new (str2) = { inherit BaseClass(); string2 = str2 }"""
({ config with MaxRecordWidth = 45 })
{ config with MaxRecordWidth = 45 }
|> prepend newline
|> should
equal
Expand Down
4 changes: 2 additions & 2 deletions src/Fantomas.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,8 @@ type substring =
min strA.Length strB.Length)
#endif
"""
({ config with
MaxInfixOperatorExpression = 60 })
{ config with
MaxInfixOperatorExpression = 60 }
|> should
equal
"""(*
Expand Down
18 changes: 9 additions & 9 deletions src/Fantomas.Tests/CompilerDirectivesTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,8 @@ let ``some spacing is still lost in and around #if blocks, 303`` () =
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""
({ config with
MaxInfixOperatorExpression = 75 })
{ config with
MaxInfixOperatorExpression = 75 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -510,8 +510,8 @@ let ``some spacing is still lost in and around #if blocks, no defines`` () =
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""
({ config with
MaxInfixOperatorExpression = 75 })
{ config with
MaxInfixOperatorExpression = 75 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -559,8 +559,8 @@ let ``some spacing is still lost in and around #if blocks, NETCOREAPP2_0`` () =
assemblyName.PublicKey <- key'.PublicKey // sets token implicitly
#endif
"""
({ config with
MaxInfixOperatorExpression = 75 })
{ config with
MaxInfixOperatorExpression = 75 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1413,7 +1413,7 @@ type internal Close =
| Pause
| Resume
"""
({ config with IndentSize = 2 })
{ config with IndentSize = 2 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1453,7 +1453,7 @@ type internal Close =
| Pause
| Resume
"""
({ config with IndentSize = 2 })
{ config with IndentSize = 2 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1493,7 +1493,7 @@ type internal Close =
| Pause
| Resume
"""
({ config with IndentSize = 2 })
{ config with IndentSize = 2 }
|> prepend newline
|> should
equal
Expand Down
16 changes: 8 additions & 8 deletions src/Fantomas.Tests/ComputationExpressionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ let ``range expressions`` () =
let factors number =
{2L .. number / 2L}
|> Seq.filter (fun x -> number % x = 0L)"""
({ config with
MaxInfixOperatorExpression = 65
MaxFunctionBindingWidth = 65 })
{ config with
MaxInfixOperatorExpression = 65
MaxFunctionBindingWidth = 65 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -1594,11 +1594,11 @@ let ``new line between let and let bang, 879`` () =
return! loop ()
}
"""
({ config with
SpaceBeforeUppercaseInvocation = true
IndentSize = 2
SpaceAroundDelimiter = false
MultilineBlockBracketsOnSameColumn = true })
{ config with
SpaceBeforeUppercaseInvocation = true
IndentSize = 2
SpaceAroundDelimiter = false
MultilineBlockBracketsOnSameColumn = true }
|> prepend newline
|> should
equal
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Tests/FormattingSelectionOnlyTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ let source = "
done;;
Multiple9x9 ();;"
"""
({ config with
MaxValueBindingWidth = 120
MaxRecordWidth = 50 })
{ config with
MaxValueBindingWidth = 120
MaxRecordWidth = 50 }
|> should equal """let config = { FormatConfig.Default with IndentSpaceNum = 2 }"""

[<Test>]
Expand Down
16 changes: 8 additions & 8 deletions src/Fantomas.Tests/FunctionDefinitionTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,10 @@ let fold (funcs : ResultFunc<'Input, 'Output, 'TError> seq) (input : 'Input) : R
| true -> Error collectedErrors
| false -> Ok collectedOutputs
"""
({ config with
MaxLineLength = 100
SpaceBeforeColon = true
MaxInfixOperatorExpression = 70 })
{ config with
MaxLineLength = 100
SpaceBeforeColon = true
MaxInfixOperatorExpression = 70 }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -586,9 +586,9 @@ let ``internal keyword included in function signature length check`` () =
let UpdateStrongNamingX (assembly : AssemblyDefinition) (key : StrongNameKeyPair option) =
assembly.Name
"""
({ config with
MaxLineLength = 90
SpaceBeforeColon = true })
{ config with
MaxLineLength = 90
SpaceBeforeColon = true }
|> prepend newline
|> should
equal
Expand Down Expand Up @@ -698,7 +698,7 @@ let private addTaskToScheduler (scheduler : IScheduler) taskName taskCron prio (
.WithIdentity(taskName, groupName).Build()
1
"""
({ config with MaxLineLength = 100 })
{ config with MaxLineLength = 100 }
|> prepend newline
|> should
equal
Expand Down
Loading

0 comments on commit b333fba

Please sign in to comment.