-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/FSharpLint.Core/Rules/Conventions/AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module FSharpLint.Rules.AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs | ||
|
||
open System | ||
open FSharp.Compiler.Syntax | ||
open FSharpLint.Framework.Ast | ||
open FSharpLint.Framework.Rules | ||
open FSharpLint.Framework | ||
open FSharpLint.Framework.Suggestion | ||
|
||
let runner (args:AstNodeRuleParams) = | ||
printfn "%A" args.AstNode | ||
failwith "not implemented" | ||
|
||
let rule = | ||
{ Name = "AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs" | ||
Identifier = Identifiers.AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs | ||
RuleConfig = | ||
{ AstNodeRuleConfig.Runner = runner | ||
Cleanup = ignore } } | ||
|> AstNodeRule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...rpLint.Core.Tests/Rules/Conventions/AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module FSharpLint.Core.Tests.Rules.Conventions.AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs | ||
|
||
open NUnit.Framework | ||
open FSharpLint.Framework.Rules | ||
open FSharpLint.Rules | ||
|
||
[<TestFixture>] | ||
type TestConventionsAvoidMisleadingRecursiveKeywordInNonRecursiveFuncs() = | ||
inherit TestAstNodeRuleBase.TestAstNodeRuleBase(AvoidMisleadingRecursiveKeywordInNonRecursiveFuncs.rule) | ||
|
||
[<Test>] | ||
member this.AvoidMisleadingRecursiveKeywordInNonRecursiveFuncsShouldNotProduceError() = | ||
this.Parse """ | ||
let rec Foo () = | ||
if someParam then | ||
Foo() | ||
else | ||
()""" | ||
|
||
Assert.IsTrue this.NoErrorsExist | ||
|
||
[<Test>] | ||
member this.AvoidMisleadingRecursiveKeywordInNonRecursiveFuncsShouldProduceError() = | ||
this.Parse """ | ||
let rec Foo someParam = | ||
()""" | ||
|
||
Assert.IsTrue this.ErrorsExist |