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

Have Include/ExcludeFilter warn if an input glob didn't match any analyzers #203

Open Smaug123 opened 7 months ago

Smaug123 commented 7 months ago

How would you feel about having IncludeFilter and ExcludeFilter be Glob list, instead of string -> bool? The FSharp.Analyzers.Cli consumer in this repo does this:

fun (s: string) -> i |> List.map Glob |> List.exists (fun g -> g.IsMatch s)
|> IncludeFilter

But what I would really like is to be able to report "this particular glob was never matched - are you sure you got it right?". That's because when I first tried using --exclude-analyzers, I used the name GRA-PARTAPP-001 rather than the correct PartialAppAnalyzer, and it was sheer coincidence that I happened to be in a repo where that warning was already firing (so I noticed I had failed to suppress it).

(Doing this would require running every glob against every analyzer, but there's presumably not going to be more than 10k analyzers ever, so that isn't going to be too much of a slowdown.)

Which of those two would you prefer, if either? (I'm happy to implement either.)

dawedawe commented 7 months ago

Hey, we are fine with the additional reporting of non-matching globs. But we shoudln't force the users of FSharp.Analyzers.SDK.Client (Editors like Ionide/FSAC) to take a dependency on Glob. So if you can do the necessary changes while keeping the SDK API in it's current state, that would be great.

Smaug123 commented 7 months ago

Cool - I'll make the change only in the CLI tool.