ionide / FSharp.Analyzers.SDK

Library for building custom analyzers for F# / FSAC
http://ionide.io/FSharp.Analyzers.SDK/
MIT License
74 stars 21 forks source link

Expected behavior of fsharp-analyzers when analyzing a project that depends on other local projects? #214

Closed Numpsy closed 1 month ago

Numpsy commented 1 month ago

When I updated the fsharp-analyzers cli tool in a solution that has multiple projects from version 0.25.0 to 0.26.0, i noticed that I had a number of duplicated analyzer warnings/suggestions in my CI build.

Testing the tool, it appears that If I have

library.fsproj (shared library project) console.fsproj (has a project reference to library.fsproj)

and I run

dotnet fsharp-analyzers --project console.fsproj ...

then it will check all the source files in both library.fsproj and console.fsproj, and output any suggestions from library.fsproj in the results.

As my CI build is running the analyzers against every project in the solution, it appears that some librarys are getting analyed multiple times, so I get duplicated suggestions.

This doesn't happen with version 0.25.0 of the cli tool, just 0.26.0 -> so I'm wondering if this is the expected behavior now? (It sounds like something that might have been changed by https://github.com/ionide/FSharp.Analyzers.SDK/pull/210, but the release notes don't mention a behavior change, so)

nojaf commented 1 month ago

Hi, it could very well be that dependent projects are implicitly analyzed. Thus leading to duplicate projects being analyzed. I'm not quite sure here, @TheAngryByrd I think you improved something in the project cracking side of things that may now lead to this behavior. Any thoughts?

TheAngryByrd commented 1 month ago

Oh yeah the use case here is to only run against one project, we should probably filter the list of loadedProjects to the list only passed in via the CLI.

Numpsy commented 1 month ago

Ok, the duplication I was seeing seems ok now in the 0.26.1 release