From 1342e1d0466f9303357b5e37ce59e3b934aff417 Mon Sep 17 00:00:00 2001 From: Mehrshad Date: Tue, 22 Aug 2023 13:53:23 +0330 Subject: [PATCH] FileConvention: fix the function Fix NotFollowingConsoleAppConvention() function. --- .../DummyFiles/DummyProjectAsync.Console/Program.fs | 4 +--- .../DummyFiles/DummyProjectAsync/Library.fs | 4 +--- src/FileConventions/Library.fs | 9 ++++++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectAsync.Console/Program.fs b/src/FileConventions.Test/DummyFiles/DummyProjectAsync.Console/Program.fs index 8f7a5c76d..6cceb79df 100644 --- a/src/FileConventions.Test/DummyFiles/DummyProjectAsync.Console/Program.fs +++ b/src/FileConventions.Test/DummyFiles/DummyProjectAsync.Console/Program.fs @@ -1,4 +1,2 @@ -async { - do! Async.Sleep(5000) -} |> Async.RunSynchronously +async { do! Async.Sleep(5000) } |> Async.RunSynchronously printf "Hello World" diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectAsync/Library.fs b/src/FileConventions.Test/DummyFiles/DummyProjectAsync/Library.fs index 0aa24d069..bf14df5fd 100644 --- a/src/FileConventions.Test/DummyFiles/DummyProjectAsync/Library.fs +++ b/src/FileConventions.Test/DummyFiles/DummyProjectAsync/Library.fs @@ -3,7 +3,5 @@ module Say = let delayedHello name = - async { - do! Async.Sleep(5000) - } |> Async.RunSynchronously + async { do! Async.Sleep(5000) } |> Async.RunSynchronously "Delayed Hello" diff --git a/src/FileConventions/Library.fs b/src/FileConventions/Library.fs index 70e4fef4e..cb37050c8 100644 --- a/src/FileConventions/Library.fs +++ b/src/FileConventions/Library.fs @@ -465,7 +465,14 @@ let NotFollowingNamespaceConvention(fileInfo: FileInfo) = let ContainsConsoleMethods(fileInfo: FileInfo) = let fileText = File.ReadAllText fileInfo.FullName - let consoleMethods = [ "printf"; "Console." ] + + let consoleMethods = + [ + "printf" + "Console." + "Async.RunSynchronously" + ] + consoleMethods |> List.exists fileText.Contains