Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in AvoidSinglePipeOperator #640

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions src/FSharpLint.Core/Rules/Conventions/AvoidSinglePipeOperator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,8 @@ let runner (args: AstNodeRuleParams) =
| SynExpr.Ident ident ->
if ident.idText = "op_PipeRight" then
match argExpr with
| SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, _argExpr, range) ->
match funcExpr with
| SynExpr.App(_exprAtomicFlag, _isInfix, funcExpr, _argExpr, range) ->
match funcExpr with
| SynExpr.Ident ident ->
if ident.idText = "op_PipeRight" then
Array.empty
else
errors range
| _ ->
errors range
| SynExpr.Ident _ident ->
Array.empty
| _ ->
errors range
| SynExpr.App(_exprAtomicFlag, _isInfix, _funcExpr, _argExpr, _range) ->
Array.empty
| _ ->
errors range
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,13 @@ let someFunc someParam =
"""

Assert.IsFalse this.ErrorsExist


[<Test>]
member this.``Use pipe operator once to avoid parenthesis on expression with function application``() =
this.Parse """
let someFunc someParam =
someOtherFunc1 someParam someParam2 |> someOtherFunc3
"""

Assert.IsFalse this.ErrorsExist
Loading