Skip to content

Commit d11d440

Browse files
committed
chore: simplify member syntax, replace __. with _.
1 parent 7ab14ab commit d11d440

File tree

17 files changed

+185
-185
lines changed

17 files changed

+185
-185
lines changed

src/FSharpLint.Console/Output.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ type StandardOutput () =
3434
Console.ForegroundColor <- originalColour
3535

3636
interface IOutput with
37-
member __.WriteInfo (info:string) = writeLine info ConsoleColor.White Console.Out
37+
member _.WriteInfo (info:string) = writeLine info ConsoleColor.White Console.Out
3838
member this.WriteWarning (warning:Suggestion.LintWarning) =
3939
let highlightedErrorText = highlightErrorText warning.Details.Range warning.ErrorText
4040
let ruleUrlHint = sprintf "See https://fsprojects.github.io/FSharpLint/how-tos/rules/%s.html" warning.RuleIdentifier
4141
let str = warning.Details.Message + Environment.NewLine + highlightedErrorText
4242
+ Environment.NewLine + ruleUrlHint
4343
writeLine str ConsoleColor.Yellow Console.Out
4444
String.replicate 80 "-" |> (this :> IOutput).WriteInfo
45-
member __.WriteError (error:string) = writeLine error ConsoleColor.Red Console.Error
45+
member _.WriteError (error:string) = writeLine error ConsoleColor.Red Console.Error
4646

4747
type MSBuildOutput () =
4848
interface IOutput with
49-
member __.WriteInfo (info:string) = Console.Out.WriteLine info
50-
member __.WriteWarning (warning:Suggestion.LintWarning) =
49+
member _.WriteInfo (info:string) = Console.Out.WriteLine info
50+
member _.WriteWarning (warning:Suggestion.LintWarning) =
5151
sprintf "%s(%d,%d,%d,%d):FSharpLint warning %s: %s"
5252
<| warning.FilePath
5353
<| warning.Details.Range.StartLine
@@ -57,6 +57,6 @@ type MSBuildOutput () =
5757
<| warning.RuleIdentifier
5858
<| warning.Details.Message
5959
|> Console.Out.WriteLine
60-
member __.WriteError (error:string) =
60+
member _.WriteError (error:string) =
6161
sprintf "FSharpLint error: %s" error
6262
|> Console.Error.WriteLine

src/FSharpLint.Core/Framework/AbstractSyntaxArray.fs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ module AbstractSyntaxArray =
139139

140140
[<Struct; NoEquality; NoComparison; DebuggerDisplay("{DebuggerDisplay,nq}")>]
141141
type TempNode(hashcode: int, actual: AstNode) =
142-
member __.Hashcode = hashcode
143-
member __.Actual = actual
142+
member _.Hashcode = hashcode
143+
member _.Actual = actual
144144

145-
member private __.DebuggerDisplay = "AstNode: " + string actual
145+
member private _.DebuggerDisplay = "AstNode: " + string actual
146146

147147
[<NoEquality; NoComparison>]
148148
type Node =
@@ -153,8 +153,8 @@ module AbstractSyntaxArray =
153153

154154
[<Struct>]
155155
type private PossibleSkip(skipPosition: int, depth: int) =
156-
member __.SkipPosition = skipPosition
157-
member __.Depth = depth
156+
member _.SkipPosition = skipPosition
157+
member _.Depth = depth
158158

159159
/// We just want a hash of the last identifier.
160160
let rec private getIdentHash = function
@@ -206,15 +206,15 @@ module AbstractSyntaxArray =
206206

207207
[<Struct; NoEquality; NoComparison>]
208208
type private StackedNode(node: AstNode, depth: int) =
209-
member __.Node = node
210-
member __.Depth = depth
209+
member _.Node = node
210+
member _.Depth = depth
211211

212212
/// Keep index of position so skip array can be created in the correct order.
213213
[<Struct>]
214214
type private TempSkip(numberOfChildren: int, parentIndex: int, index: int) =
215-
member __.NumberOfChildren = numberOfChildren
216-
member __.Index = index
217-
member __.ParentIndex = parentIndex
215+
member _.NumberOfChildren = numberOfChildren
216+
member _.Index = index
217+
member _.ParentIndex = parentIndex
218218

219219
/// Contains information on the current node being visited.
220220
[<NoEquality; NoComparison>]

tests/FSharpLint.Console.Tests/TestApp.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type TemporaryFile(fileContent : string, extension) =
1515
do
1616
File.WriteAllText(filename, fileContent)
1717

18-
member __.FileName = filename
18+
member _.FileName = filename
1919

2020
interface System.IDisposable with
21-
member __.Dispose() =
21+
member _.Dispose() =
2222
File.Delete(filename)
2323

2424
let main input =
@@ -34,7 +34,7 @@ let main input =
3434
[<TestFixture>]
3535
type TestConsoleApplication() =
3636
[<Test>]
37-
member __.``Lint file, expected rules are triggered.``() =
37+
member _.``Lint file, expected rules are triggered.``() =
3838
let fileContent = """
3939
type Signature =
4040
abstract member Encoded : string
@@ -48,7 +48,7 @@ type TestConsoleApplication() =
4848
Assert.AreEqual(set ["Consider changing `Signature` to be prefixed with `I`."], errors)
4949

5050
[<Test>]
51-
member __.``Lint source without any config, rule enabled in default config is triggered for given source.``() =
51+
member _.``Lint source without any config, rule enabled in default config is triggered for given source.``() =
5252
let input = """
5353
type Signature =
5454
abstract member Encoded : string
@@ -61,7 +61,7 @@ type TestConsoleApplication() =
6161
Assert.AreEqual(set ["Consider changing `Signature` to be prefixed with `I`."], errors)
6262

6363
[<Test>]
64-
member __.``Lint source with valid config to disable rule, disabled rule is not triggered for given source.``() =
64+
member _.``Lint source with valid config to disable rule, disabled rule is not triggered for given source.``() =
6565
let fileContent = """
6666
{
6767
"InterfaceNames": {
@@ -83,7 +83,7 @@ type TestConsoleApplication() =
8383
Assert.AreEqual(Set.empty<string>, errors)
8484

8585
[<Test>]
86-
member __.``Lint source with error suppressed, no error is given.``() =
86+
member _.``Lint source with error suppressed, no error is given.``() =
8787
let input = """
8888
// fsharplint:disable-next-line
8989
type Signature =
@@ -97,7 +97,7 @@ type TestConsoleApplication() =
9797
Assert.AreEqual(Set.empty<string>, errors)
9898

9999
[<Test>]
100-
member __.``Regression test: typePrefixing rule with old config format should still work``() =
100+
member _.``Regression test: typePrefixing rule with old config format should still work``() =
101101
let fileContent = """
102102
{
103103
"typePrefixing": {

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,57 +34,57 @@ type TestAst() =
3434
let astNodeName = removeParens >> unionCaseName
3535

3636
[<Test>]
37-
member __.``Flatten with right pipe adds lhs to end of function application.``() =
37+
member _.``Flatten with right pipe adds lhs to end of function application.``() =
3838
match generateAst "x |> List.map (fun x -> x)" |> astToExpr |> Expression with
3939
| FuncApp(expressions, _) ->
4040
Assert.AreEqual(["LongIdent"; "Lambda"; "Ident"], expressions |> List.map astNodeName)
4141
| _ -> Assert.Fail()
4242

4343
[<Test>]
44-
member __.``Flatten with left pipe adds rhs to end of function application.``() =
44+
member _.``Flatten with left pipe adds rhs to end of function application.``() =
4545
match generateAst "List.map (fun x -> x) <| x" |> astToExpr |> Expression with
4646
| FuncApp(expressions, _) ->
4747
Assert.AreEqual(["LongIdent"; "Lambda"; "Ident"], expressions |> List.map astNodeName)
4848
| _ -> Assert.Fail()
4949

5050
[<Test>]
51-
member __.``Flatten with right pipe adds lhs to end of function application no matter the number of arguments on rhs.``() =
51+
member _.``Flatten with right pipe adds lhs to end of function application no matter the number of arguments on rhs.``() =
5252
match generateAst "x |> List.map (fun x -> x) 1" |> astToExpr |> Expression with
5353
| FuncApp(expressions, _) ->
5454
Assert.AreEqual(["LongIdent"; "Lambda"; "Const"; "Ident"], expressions |> List.map astNodeName)
5555
| _ -> Assert.Fail()
5656

5757
[<Test>]
58-
member __.``Flatten with binary operator on lhs of right pipe.``() =
58+
member _.``Flatten with binary operator on lhs of right pipe.``() =
5959
match generateAst "x::[] |> List.map (fun x -> x)" |> astToExpr |> Expression with
6060
| FuncApp(expressions, _) ->
6161
Assert.AreEqual(["LongIdent"; "Lambda"; "App"], expressions |> List.map astNodeName)
6262
| _ -> Assert.Fail()
6363

6464
[<Test>]
65-
member __.``Flatten with function application on lhs of right pipe.``() =
65+
member _.``Flatten with function application on lhs of right pipe.``() =
6666
match generateAst "foo x |> List.map (fun x -> x)" |> astToExpr |> Expression with
6767
| FuncApp(expressions, _) ->
6868
Assert.AreEqual(["LongIdent"; "Lambda"; "App"], expressions |> List.map astNodeName)
6969
| _ -> Assert.Fail()
7070

7171
[<Test>]
72-
member __.``Flatten with multiple right pipes.``() =
72+
member _.``Flatten with multiple right pipes.``() =
7373
match generateAst "x |> foo |> List.map (fun x -> x)" |> astToExpr |> Expression with
7474
| FuncApp(expressions, _) ->
7575
Assert.AreEqual(["LongIdent"; "Lambda"; "App"], expressions |> List.map astNodeName)
7676
| _ -> Assert.Fail()
7777

7878
[<Test>]
79-
member __.``Flatten with multiple left pipes.``() =
79+
member _.``Flatten with multiple left pipes.``() =
8080
match generateAst "List.map (fun x -> x) <| 1 <| x" |> astToExpr |> Expression with
8181
| FuncApp(expressions, _) ->
8282
Assert.AreEqual(["LongIdent"; "Lambda"; "Const"; "Ident"], expressions |> List.map astNodeName)
8383
| _ -> Assert.Fail()
8484

8585
[<Category("Performance")>]
8686
[<Test>]
87-
member __.``Performance of building syntax array``() =
87+
member _.``Performance of building syntax array``() =
8888
let (tree, _) = getPerformanceTestInput ()
8989

9090
let iterations = 100
@@ -107,7 +107,7 @@ type TestAst() =
107107
fprintf TestContext.Out "Built array in an average of %d milliseconds." result
108108

109109
[<Test>]
110-
member __.``Syntax array constructed from AST in valid order.``() =
110+
member _.``Syntax array constructed from AST in valid order.``() =
111111
let tree = generateAst "List.map (fun x y -> id x) woofs"
112112

113113
let array = astToArray tree
@@ -153,7 +153,7 @@ type TestAst() =
153153

154154
/// e.g. a lambda arg shouldn't have the body of the lambda in its child nodes (that should be a sibling).
155155
[<Test>]
156-
member __.``Syntax array's extra info nodes do not contain children of node they're generated from.``() =
156+
member _.``Syntax array's extra info nodes do not contain children of node they're generated from.``() =
157157
let tree = generateAst "fun x -> x"
158158

159159
let array = astToArray tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open FSharpLint.Framework.AstInfo
77
type TestAstInfo() =
88

99
[<Test>]
10-
member __.IsOperator() =
10+
member _.IsOperator() =
1111
Assert.IsTrue(isOperator "op_LeftShift")
1212

1313
Assert.IsTrue(isOperator "op_TwiddleEqualsDivideComma")

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let configWithHints hints =
1414
[<TestFixture>]
1515
type TestConfiguration() =
1616
[<Test>]
17-
member __.``Ignore all files ignores any given file.``() =
17+
member _.``Ignore all files ignores any given file.``() =
1818
let ignorePaths = [ IgnoreFiles.parseIgnorePath "*" ]
1919

2020
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -23,7 +23,7 @@ type TestConfiguration() =
2323
|> Assert.IsTrue
2424

2525
[<Test>]
26-
member __.``Ignoring a file name not inside a path does not ignore the path``() =
26+
member _.``Ignoring a file name not inside a path does not ignore the path``() =
2727
let ignorePaths = [ IgnoreFiles.parseIgnorePath "cat" ]
2828

2929
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -32,7 +32,7 @@ type TestConfiguration() =
3232
|> Assert.IsFalse
3333

3434
[<Test>]
35-
member __.``Ignoring a file doesn't ignore a directory.``() =
35+
member _.``Ignoring a file doesn't ignore a directory.``() =
3636
let ignorePaths = [ IgnoreFiles.parseIgnorePath "dog" ]
3737

3838
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -41,7 +41,7 @@ type TestConfiguration() =
4141
|> Assert.IsFalse
4242

4343
[<Test>]
44-
member __.``Ignoring a directory doesn't ignore a file.``() =
44+
member _.``Ignoring a directory doesn't ignore a file.``() =
4545
let ignorePaths = [ IgnoreFiles.parseIgnorePath "source.fs/" ]
4646

4747
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -50,7 +50,7 @@ type TestConfiguration() =
5050
|> Assert.IsFalse
5151

5252
[<Test>]
53-
member __.``Ignoring all files in a given directory ignores a given file from the directory.``() =
53+
member _.``Ignoring all files in a given directory ignores a given file from the directory.``() =
5454
let ignorePaths = [ IgnoreFiles.parseIgnorePath "dog/*" ]
5555

5656
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -59,7 +59,7 @@ type TestConfiguration() =
5959
|> Assert.IsTrue
6060

6161
[<Test>]
62-
member __.``Ignoring a file that does not exist inside a directory that does exist does not ignore the file.``() =
62+
member _.``Ignoring a file that does not exist inside a directory that does exist does not ignore the file.``() =
6363
let ignorePaths = [ IgnoreFiles.parseIgnorePath "dog/source1" ]
6464

6565
let path = @"D:\dog\source.fs".ToPlatformIndependentPath()
@@ -68,7 +68,7 @@ type TestConfiguration() =
6868
|> Assert.IsFalse
6969

7070
[<Test>]
71-
member __.``Ignoring the contents of a directory and then negating a specific file ignores all files other than the negated file.``() =
71+
member _.``Ignoring the contents of a directory and then negating a specific file ignores all files other than the negated file.``() =
7272
let ignorePaths =
7373
[ IgnoreFiles.parseIgnorePath "dog/*"
7474
IgnoreFiles.parseIgnorePath "!source.*" ]
@@ -84,7 +84,7 @@ type TestConfiguration() =
8484
|> Assert.IsTrue
8585

8686
[<Test>]
87-
member __.``Ingoring a file that was previously negated ignores the file.``() =
87+
member _.``Ingoring a file that was previously negated ignores the file.``() =
8888
let ignorePaths =
8989
[ IgnoreFiles.parseIgnorePath "dog/*"
9090
IgnoreFiles.parseIgnorePath "!source.*"
@@ -96,7 +96,7 @@ type TestConfiguration() =
9696
|> Assert.IsTrue
9797

9898
[<Test>]
99-
member __.``Camel case JSON config correctly parsed into expected config records`` () =
99+
member _.``Camel case JSON config correctly parsed into expected config records`` () =
100100
let expectedConfig =
101101
{ Configuration.Zero with NoTabCharacters = Some { Enabled = true; Config = None } }
102102

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ open FSharpLint.Framework.ExpressionUtilities
77
[<TestFixture>]
88
type TestExpressionUtilities() =
99
[<Test>]
10-
member __.``TryFindTextOfRange gets expected text from given ranges``() =
10+
member _.``TryFindTextOfRange gets expected text from given ranges``() =
1111
let text = "123\n345\n678"
1212

1313
let textOfRange (line1, col1) (line2, col2) =

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type TestAst() =
2929

3030
[<Category("Performance")>]
3131
[<Test>]
32-
member __.``Performance of matching fuzzy matching hints``() =
32+
member _.``Performance of matching fuzzy matching hints``() =
3333
let (tree, _) = getPerformanceTestInput ()
3434

3535
let array = astToArray tree
@@ -150,7 +150,7 @@ type TestAst() =
150150

151151
[<Category("Hint Matcher")>]
152152
[<Test>]
153-
member __.``Lambda with wildcard argument is correctly found by fuzzy matcher``() =
153+
member _.``Lambda with wildcard argument is correctly found by fuzzy matcher``() =
154154
let source = @"
155155
do
156156
let y = fun _ -> ()
@@ -168,7 +168,7 @@ do
168168

169169
[<Category("Hint Matcher")>]
170170
[<Test>]
171-
member __.``Function application is correctly found by fuzzy matcher``() =
171+
member _.``Function application is correctly found by fuzzy matcher``() =
172172
let source = @"
173173
do
174174
let y = List.isEmpty []
@@ -186,7 +186,7 @@ do
186186

187187
[<Category("Hint Matcher")>]
188188
[<Test>]
189-
member __.``Infix application is correctly found by fuzzy matcher``() =
189+
member _.``Infix application is correctly found by fuzzy matcher``() =
190190
let source = @"
191191
do
192192
let y = 1 + 0
@@ -204,7 +204,7 @@ do
204204

205205
[<Category("Hint Matcher")>]
206206
[<Test>]
207-
member __.``Prefix application is correctly found by fuzzy matcher``() =
207+
member _.``Prefix application is correctly found by fuzzy matcher``() =
208208
let source = @"
209209
do
210210
let y = ~~~1
@@ -222,7 +222,7 @@ do
222222

223223
[<Category("Hint Matcher")>]
224224
[<Test>]
225-
member __.``Function application with variable is correctly found by fuzzy matcher``() =
225+
member _.``Function application with variable is correctly found by fuzzy matcher``() =
226226
let source = @"
227227
do
228228
let numbers = [1;2;3]
@@ -241,7 +241,7 @@ do
241241

242242
[<Category("Hint Matcher")>]
243243
[<Test>]
244-
member __.``Lambda with variable argument is correctly found by fuzzy matcher``() =
244+
member _.``Lambda with variable argument is correctly found by fuzzy matcher``() =
245245
let source = @"
246246
do
247247
let y = fun x -> x
@@ -259,7 +259,7 @@ do
259259

260260
[<Category("Hint Matcher")>]
261261
[<Test>]
262-
member __.``Lambda with variable argument is correctly discarded by fuzzy matcher``() =
262+
member _.``Lambda with variable argument is correctly discarded by fuzzy matcher``() =
263263
let source = @"
264264
do
265265
let y = fun x -> 0

0 commit comments

Comments
 (0)