Skip to content

Commit aed1545

Browse files
committed
Core,Tests: fix FSharpLint warning
Fixing the warning for the FavourTypedIgnore rule: ``` Use a generic type parameter when calling the 'ignore' function. Error on line 518 starting at column 16 lintWarnings.AddLast warning |> ignore ```
1 parent b15206d commit aed1545

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

src/FSharpLint.Core/Application/Lint.fs

+6-6
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ module Lint =
282282

283283
use p = new System.Diagnostics.Process(StartInfo = psi)
284284
let sbOut = System.Text.StringBuilder()
285-
p.OutputDataReceived.Add(fun ea -> sbOut.AppendLine(ea.Data) |> ignore)
285+
p.OutputDataReceived.Add(fun ea -> sbOut.AppendLine(ea.Data) |> ignore<Text.StringBuilder>)
286286
let sbErr = System.Text.StringBuilder()
287-
p.ErrorDataReceived.Add(fun ea -> sbErr.AppendLine(ea.Data) |> ignore)
288-
p.Start() |> ignore
287+
p.ErrorDataReceived.Add(fun ea -> sbErr.AppendLine(ea.Data) |> ignore<Text.StringBuilder>)
288+
p.Start() |> ignore<bool>
289289
p.BeginOutputReadLine()
290290
p.BeginErrorReadLine()
291291
p.WaitForExit()
@@ -410,7 +410,7 @@ module Lint =
410410
let projectProgress = Option.defaultValue ignore optionalParams.ReportLinterProgress
411411

412412
let warningReceived (warning:Suggestion.LintWarning) =
413-
lintWarnings.AddLast warning |> ignore
413+
lintWarnings.AddLast warning |> ignore<LinkedListNode<Suggestion.LintWarning>>
414414

415415
optionalParams.ReceivedWarning |> Option.iter (fun func -> func warning)
416416

@@ -517,7 +517,7 @@ module Lint =
517517
let lintWarnings = LinkedList<Suggestion.LintWarning>()
518518

519519
let warningReceived (warning:Suggestion.LintWarning) =
520-
lintWarnings.AddLast warning |> ignore
520+
lintWarnings.AddLast warning |> ignore<LinkedListNode<Suggestion.LintWarning>>
521521

522522
optionalParams.ReceivedWarning |> Option.iter (fun func -> func warning)
523523
let lintInformation =
@@ -559,7 +559,7 @@ module Lint =
559559
let lintWarnings = LinkedList<Suggestion.LintWarning>()
560560

561561
let warningReceived (warning:Suggestion.LintWarning) =
562-
lintWarnings.AddLast warning |> ignore
562+
lintWarnings.AddLast warning |> ignore<LinkedListNode<Suggestion.LintWarning>>
563563

564564
optionalParams.ReceivedWarning |> Option.iter (fun func -> func warning)
565565

src/FSharpLint.Core/Framework/Utilities.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module Dictionary =
1717

1818
let addOrUpdate key value (dict:Dictionary<'Key,'Value>) =
1919
if dict.ContainsKey(key) then
20-
dict.Remove(key) |> ignore
20+
dict.Remove(key) |> ignore<bool>
2121

2222
dict.Add(key, value)
2323

src/FSharpLint.Core/Rules/Conventions/CyclomaticComplexity.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type private BindingStack(maxComplexity: int) =
5252
let popped = tier1.Head
5353
tier1 <- tier1.Tail
5454
if popped.Complexity > maxComplexity then
55-
tier2.Add popped |> ignore
55+
tier2.Add popped |> ignore<bool>
5656
// finally, push the item on to the stack
5757
tier1 <- bs::tier1
5858

src/FSharpLint.Core/Rules/Hints/HintMatcher.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ module private MatchExpression =
257257
| _ -> NoMatch
258258
| Expression.Variable(var) ->
259259
match expr with
260-
| AstNode.Expression(expr) -> arguments.MatchedVariables.TryAdd(var, expr) |> ignore
260+
| AstNode.Expression(expr) -> arguments.MatchedVariables.TryAdd(var, expr) |> ignore<bool>
261261
| _ -> ()
262262
Match([])
263263
| Expression.Wildcard ->

tests/FSharpLint.Benchmarks/Benchmark.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ type Benchmark () =
3535

3636
[<Benchmark>]
3737
member this.LintParsedFile () =
38-
lintParsedFile OptionalLintParameters.Default fileInfo sourceFile |> ignore
38+
lintParsedFile OptionalLintParameters.Default fileInfo sourceFile |> ignore<LintResult>

tests/FSharpLint.Benchmarks/Program.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ let main _ =
1111
.Run<Benchmark>(
1212
DefaultConfig.Instance
1313
.AddJob(Job.Default)
14-
.AddDiagnoser(EtwProfiler())) |> ignore
14+
.AddDiagnoser(EtwProfiler())) |> ignore<BenchmarkDotNet.Reports.Summary>
1515
0

tests/FSharpLint.Core.Tests/Framework/TestAbstractSyntaxArray.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type TestAst() =
9595
for _ in 0..iterations do
9696
stopwatch.Restart()
9797

98-
astToArray tree |> ignore
98+
astToArray tree |> ignore<Node array>
9999

100100
stopwatch.Stop()
101101

tests/FSharpLint.FunctionalTest/TestApi.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module TestApi =
4949
for _ in 0..iterations do
5050
stopwatch.Restart()
5151

52-
lintParsedFile OptionalLintParameters.Default fileInfo sourceFile |> ignore
52+
lintParsedFile OptionalLintParameters.Default fileInfo sourceFile |> ignore<LintResult>
5353

5454
stopwatch.Stop()
5555

0 commit comments

Comments
 (0)