From d8f75b63e4f11ebb06f8da46e0f9374824123ff9 Mon Sep 17 00:00:00 2001 From: nojaf Date: Thu, 26 Oct 2023 10:00:02 +0200 Subject: [PATCH 1/2] Allow to specify multiple analyzers-paths. --- src/FSharp.Analyzers.Cli/Program.fs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/FSharp.Analyzers.Cli/Program.fs b/src/FSharp.Analyzers.Cli/Program.fs index c937185..d0af147 100644 --- a/src/FSharp.Analyzers.Cli/Program.fs +++ b/src/FSharp.Analyzers.Cli/Program.fs @@ -12,7 +12,7 @@ open Ionide.ProjInfo type Arguments = | Project of string list - | Analyzers_Path of string + | Analyzers_Path of string list | Fail_On_Warnings of string list | Ignore_Files of string list | Exclude_Analyzer of string list @@ -252,15 +252,16 @@ let main argv = printInfo "Ignore Files: [%s]" (ignoreFiles |> String.concat ", ") let ignoreFiles = ignoreFiles |> List.map Glob - let analyzersPath = - let path = results.GetResult(<@ Analyzers_Path @>, "packages/Analyzers") + let analyzersPaths = + results.GetResult(<@ Analyzers_Path @>, [ "packages/Analyzers" ]) + |> List.map (fun path -> + if Path.IsPathRooted path then + path + else + Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, path)) + ) - if Path.IsPathRooted path then - path - else - Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, path)) - - printInfo "Loading analyzers from %s" analyzersPath + printInfo "Loading analyzers from %s" (String.concat ", " analyzersPaths) let excludeAnalyzers = results.GetResult(<@ Exclude_Analyzer @>, []) @@ -291,7 +292,12 @@ let main argv = let client = Client(logger, Set.ofList excludeAnalyzers) - let dlls, analyzers = client.LoadAnalyzers analyzersPath + let dlls, analyzers = + ((0, 0), analyzersPaths) + ||> List.fold (fun (accDlls, accAnalyzers) analyzersPath -> + let dlls, analyzers = client.LoadAnalyzers analyzersPath + (accDlls + dlls), (accAnalyzers + analyzers) + ) printInfo "Registered %d analyzers from %d dlls" analyzers dlls From 68d370bdb6c0dfce7d20f891480ecf2f64df950b Mon Sep 17 00:00:00 2001 From: nojaf Date: Thu, 26 Oct 2023 10:26:13 +0200 Subject: [PATCH 2/2] Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e37333..421d174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed * [Use fixed version of FCS and FSharp.Core](https://github.com/ionide/FSharp.Analyzers.SDK/pull/127) (thanks @nojaf!) +* [Allow to specify multiple analyzers-paths](https://github.com/ionide/FSharp.Analyzers.SDK/pull/128) (thanks @nojaf!) ## [0.16.0] - 2023-10-16