Skip to content

Commit a848a1f

Browse files
authored
Merge PR #758 from webwarrior-ws/rule-46-fix
Fix ParameterNames rule to not act on fields.
2 parents 168ac5f + 148445c commit a848a1f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/FSharpLint.Core/Rules/Conventions/Naming/ParameterNames.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ let private getIdentifiers (args:AstNodeRuleParams) =
4141
| AstNode.Binding(SynBinding(access, _, _, _, attributes, _, valData, pattern, _, _, _, _, _)) ->
4242
if not (isLiteral attributes) then
4343
match identifierTypeFromValData valData with
44-
| Value | Function ->
44+
| Function ->
4545
let accessControlLevel = getAccessControlLevel args.SyntaxArray args.NodeIndex
4646
getPatternIdents accessControlLevel (getValueOrFunctionIdents args.CheckInfo) true pattern
4747
| Member | Property ->

tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/ParameterNames.fs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ let result = extractInt singleCaseDU
7878
let source = """
7979
module Program
8080
81-
let __foo_bar = 0
81+
let baz __foo_bar = 0
8282
"""
8383

8484
let expected = """
8585
module Program
8686
87-
let __foobar = 0
87+
let baz __foobar = 0
8888
"""
8989

9090
this.Parse source
@@ -114,3 +114,14 @@ let foo ((x, y) as bar_coord) = bar_coord
114114
"""
115115

116116
Assert.IsTrue this.ErrorsExist
117+
118+
[<Test>]
119+
member this.``Module members should not cause errors as they are not parameters``() =
120+
this.Parse """
121+
module BitLaunch =
122+
module Regions =
123+
let Bucharest = "Bucharest"
124+
let Amsterdam someArg = "Amsterdam"
125+
"""
126+
127+
Assert.IsFalse this.ErrorsExist

0 commit comments

Comments
 (0)