Skip to content

Only Analyze projects passed in via CLI #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.26.1] - 2024-08-05

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