From 9bfb5b13b0bc5e9089681f2396427b028bddce06 Mon Sep 17 00:00:00 2001 From: Nicholas Hirschey Date: Wed, 1 Mar 2023 15:34:37 +0000 Subject: [PATCH 1/4] Rely on project file IsTestProject to exclude tests --- src/fsdocs-tool/ProjectCracker.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fsdocs-tool/ProjectCracker.fs b/src/fsdocs-tool/ProjectCracker.fs index 7436ee495..144c6bd00 100644 --- a/src/fsdocs-tool/ProjectCracker.fs +++ b/src/fsdocs-tool/ProjectCracker.fs @@ -426,12 +426,12 @@ module Crack = let projectFiles = projectFiles |> List.choose (fun s -> - if s.Contains(".Tests") || s.Contains("test") then - printfn " skipping project '%s' because it looks like a test project" (Path.GetFileName s) + if s.Contains("FSharp.ApiDocs.Tests") || s.Contains("FSharp.Formatting.TestHelpers") then + printfn " skipping project '%s' because it looks like a FSharp.Formatting test project" (Path.GetFileName s) None else Some s) - + //printfn "filtered projects = %A" projectFiles if projectFiles.Length = 0 && (ignoreProjects |> not) then printfn "no project files found, no API docs will be generated" From 44054797cb819e8abc5ca7ae06ebb8f9965aa92f Mon Sep 17 00:00:00 2001 From: Nicholas Hirschey Date: Wed, 1 Mar 2023 15:51:29 +0000 Subject: [PATCH 2/4] more general skip of FSharp.Formatting tests --- src/fsdocs-tool/ProjectCracker.fs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fsdocs-tool/ProjectCracker.fs b/src/fsdocs-tool/ProjectCracker.fs index 144c6bd00..b30ee30ee 100644 --- a/src/fsdocs-tool/ProjectCracker.fs +++ b/src/fsdocs-tool/ProjectCracker.fs @@ -426,12 +426,15 @@ module Crack = let projectFiles = projectFiles |> List.choose (fun s -> - if s.Contains("FSharp.ApiDocs.Tests") || s.Contains("FSharp.Formatting.TestHelpers") then - printfn " skipping project '%s' because it looks like a FSharp.Formatting test project" (Path.GetFileName s) + // Other libraries' test projects will be filtered out by projInfos later on, + // but this make sure FSharp.Formatting.ApiDocs test projects get excluded. + if s.Contains("tests\\FSharp") then + printfn " skipping project '%s' because it looks like a test project" (Path.GetFileName s) + None else Some s) - + //printfn "filtered projects = %A" projectFiles if projectFiles.Length = 0 && (ignoreProjects |> not) then printfn "no project files found, no API docs will be generated" From b8359183f28c8d8e7954e6a2b2f839a94068f7f8 Mon Sep 17 00:00:00 2001 From: Nicholas Hirschey Date: Wed, 1 Mar 2023 15:54:15 +0000 Subject: [PATCH 3/4] bump release notes --- RELEASE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 0cb0e92e5..9ff4f88d4 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +## 17.3.0 + +* Better test project detection [#800](https://github.com/fsprojects/FSharp.Formatting/issues/800) + ## 17.2.3 * Fix external docs link [#794](https://github.com/fsprojects/FSharp.Formatting/issues/794) From 550881f3326e83dce9ce532ca2f07934a84fb82e Mon Sep 17 00:00:00 2001 From: Nicholas Hirschey Date: Fri, 3 Mar 2023 18:37:03 +0000 Subject: [PATCH 4/4] more strict filtering of FSharp.Formatting test projects. --- src/fsdocs-tool/ProjectCracker.fs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/fsdocs-tool/ProjectCracker.fs b/src/fsdocs-tool/ProjectCracker.fs index b30ee30ee..90bed8fb7 100644 --- a/src/fsdocs-tool/ProjectCracker.fs +++ b/src/fsdocs-tool/ProjectCracker.fs @@ -425,15 +425,16 @@ module Crack = //printfn "projects = %A" projectFiles let projectFiles = projectFiles - |> List.choose (fun s -> - // Other libraries' test projects will be filtered out by projInfos later on, - // but this make sure FSharp.Formatting.ApiDocs test projects get excluded. - if s.Contains("tests\\FSharp") then - printfn " skipping project '%s' because it looks like a test project" (Path.GetFileName s) + |> List.filter (fun s -> + let isFSharpFormattingTestProject = + s.Contains $"FSharp.ApiDocs.Tests{Path.DirectorySeparatorChar}files" + || s.EndsWith "FSharp.Formatting.TestHelpers.fsproj" - None - else - Some s) + if isFSharpFormattingTestProject then + printfn + $" skipping project '%s{Path.GetFileName s}' because the project is part of the FSharp.Formatting test suite." + + not isFSharpFormattingTestProject) //printfn "filtered projects = %A" projectFiles if projectFiles.Length = 0 && (ignoreProjects |> not) then