diff --git a/src/FSharpLint.Core/Rules/Conventions/Naming/PublicValuesNames.fs b/src/FSharpLint.Core/Rules/Conventions/Naming/PublicValuesNames.fs index 774dc3651..4633a8d35 100644 --- a/src/FSharpLint.Core/Rules/Conventions/Naming/PublicValuesNames.fs +++ b/src/FSharpLint.Core/Rules/Conventions/Naming/PublicValuesNames.fs @@ -36,7 +36,7 @@ let private getIdentifiers (args:AstNodeRuleParams) = | AstNode.Expression(SynExpr.ForEach(_, _, _, true, pattern, _, _, _)) -> getPatternIdents AccessControlLevel.Private (getValueOrFunctionIdents args.CheckInfo) false pattern | AstNode.Binding(SynBinding(_, _, _, _, attributes, _, valData, pattern, _, _, _, _, _)) -> - if not (isLiteral attributes || isExtern attributes) then + if not (isLiteral attributes || isExtern attributes || isNested args args.NodeIndex) then match identifierTypeFromValData valData with | Value | Function -> let accessibility = getAccessControlLevel args.SyntaxArray args.NodeIndex diff --git a/tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/PublicValuesNames.fs b/tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/PublicValuesNames.fs index 0cbf5eb6b..f1bebf3a0 100644 --- a/tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/PublicValuesNames.fs +++ b/tests/FSharpLint.Core.Tests/Rules/Conventions/Naming/PublicValuesNames.fs @@ -94,3 +94,23 @@ let (|Empty|_|) str = """ this.AssertNoWarnings() + +let pascalCaseConfig = { config with Naming = Some NamingCase.PascalCase } + +[] +type TestConventionsPublicValuesNamesPascalCase() = + inherit TestAstNodeRuleBase.TestAstNodeRuleBase(PublicValuesNames.rule pascalCaseConfig) + + [] + member this.``Nested function should not generate warning``() = + this.Parse """ +module Program + +[ "one" ] +|> Seq.iter (fun str -> + let someFunc bar = bar + someFunc str +) +""" + + this.AssertNoWarnings()