Skip to content

Commit

Permalink
Analyze only projects passed in via CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAngryByrd committed Aug 5, 2024
1 parent 6dd3cd1 commit 6581249
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Fixed
* [Reset the console foreground colour after printing results](https://github.com/ionide/FSharp.Analyzers.SDK/pull/216) (thanks @Numpsy!)
* [Only Analyze projects passed in via CLI](https://github.com/ionide/FSharp.Analyzers.SDK/pull/217) (thanks @TheAngryByrd)

## [0.26.0] - 2024-05-15

Expand Down
9 changes: 8 additions & 1 deletion src/FSharp.Analyzers.Cli/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ let rec mkKn (ty: Type) =

let mutable logger: ILogger = Abstractions.NullLogger.Instance

/// <summary>Runs MSBuild to create FSharpProjectOptions based on the projPaths.</summary>
/// <returns>Returns only the FSharpProjectOptions based on the projPaths and not any referenced projects.</returns>
let loadProjects toolsPath properties (projPaths: string list) =
async {
let projPaths =
Expand All @@ -140,7 +142,12 @@ let loadProjects toolsPath properties (projPaths: string list) =
logger.LogError("Failed to load project '{0}'", failedLoads)
exit 1

return FCS.mapManyOptions projectOptions |> Seq.toList
let loaded =
FCS.mapManyOptions projectOptions
|> Seq.filter (fun p -> projPaths |> List.exists (fun x -> x = p.ProjectFileName)) // We only want to analyze what was passed in
|> Seq.toList

return loaded
}

let runProject
Expand Down

0 comments on commit 6581249

Please sign in to comment.