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 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