Skip to content

Commit

Permalink
UsedUnderscorePrefixedElements: fix for _ func args
Browse files Browse the repository at this point in the history
Fix rule so that it doesn't produce error on `_` function arguments.
  • Loading branch information
webwarrior-ws committed Dec 20, 2023
1 parent d07cba7 commit 3cf31e2
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ let runner (args: AstNodeRuleParams) =
| Some checkResults ->
checkResults.GetAllUsesOfAllSymbolsInFile()
|> Seq.choose (fun usage ->
if not usage.IsFromDefinition && usage.Symbol.FullName.StartsWith "_" then
Some {
Range = usage.Range
Message = String.Format(Resources.GetString ("RulesUsedUnderscorePrefixedElements"))
SuggestedFix = None
TypeChecks = List.Empty
}
else
None)
match usage.Symbol with
| :? FSharp.Compiler.Symbols.FSharpMemberOrFunctionOrValue as symbol ->
if not usage.IsFromDefinition && symbol.FullName.StartsWith "_"
&& symbol.FullName <> "_" && not symbol.IsCompilerGenerated then
Some {
Range = usage.Range
Message = String.Format(Resources.GetString ("RulesUsedUnderscorePrefixedElements"))
SuggestedFix = None
TypeChecks = List.Empty
}
else
None
| _ -> None )
|> Seq.toArray
| None -> Array.empty
else
Expand Down

0 comments on commit 3cf31e2

Please sign in to comment.