-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Fail the tool when analyzers fail to load #198
Conversation
@@ -185,6 +194,8 @@ type Client<'TAttribute, 'TContext when 'TAttribute :> AnalyzerAttribute and 'TC | |||
then | |||
true | |||
else | |||
System.Threading.Interlocked.Increment skippedAssemblies |> ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This is an idiom I strongly prefer, because it's robust against people choosing in the future to parallelise the Array.filter
. Of course, I could rewrite this as a fold instead if mutability is considered harmful.)
@@ -233,10 +244,22 @@ type Client<'TAttribute, 'TContext when 'TAttribute :> AnalyzerAttribute and 'TC | |||
registeredAnalyzers.AddOrUpdate(path, analyzers, (fun _ _ -> analyzers)) | |||
|> ignore | |||
|
|||
Array.length analyzers, analyzers |> Seq.collect snd |> Seq.length | |||
let assemblyCount = Array.length analyzers | |||
let analyzerCount = analyzers |> Seq.sumBy (snd >> Seq.length) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by efficiency change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, makes sense.
@Smaug123 One thing: Could you add a changelog entry, please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I'm also on board with this.
The changelog entry (in CHANGELOG.md) would look like:
## [Unreleased]
### Changed
* [Good entry here](https://github.com/ionide/FSharp.Analyzers.SDK/pull/198) (thanks @Smaug123)
Out of interest, what assemblies failed to load in your case?
Actual assemblies with analyzers or other DLLs it tried to load?
This was motivated by https://github.com/Smaug123/fsharp-prattparser and specifically https://github.com/Smaug123/fsharp-prattparser/actions/runs/7618965411/job/20751163083 :
|
The tool currently silently swallows this sort of error.
This change is backward incompatible. Is that OK?