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

Fail the tool if any analysis fails #200

Closed Smaug123 closed 7 months ago

Smaug123 commented 7 months ago

Motivation is https://github.com/Smaug123/fsharp-prattparser/actions/runs/7619221208/job/20751901249 , which succeeded despite the output being as follows:

info: Running in verbose mode
info: Treat as Hints: []
info: Treat as Info: []
info: Treat as Warning: []
info: Treat as Error: [GRA-IMMUTABLECOLLECTIONEQUALITY-001, GRA-INTERPOLATED-001, GRA-JSONOPTS-001, GRA-LOGARGFUNCFULLAPP-001, GRA-STRING-001, GRA-STRING-002, GRA-STRING-003, GRA-TYPE-ANNOTATE-001, GRA-UNIONCASE-001, GRA-VIRTUALCALL-001]
info: Exclude Files: []
info: Include Files: []
info: Loading analyzers from /home/runner/work/fsharp-prattparser/fsharp-prattparser/.analyzerpackages/g-research.fsharp.analyzers/0.7.0/
info: Registered 12 analyzers from 1 dlls
error: Checking of file /home/runner/work/fsharp-prattparser/fsharp-prattparser/PrattParser/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.fs aborted
error: Checking of file /home/runner/work/fsharp-prattparser/fsharp-prattparser/PrattParser/obj/Debug/net8.0/PrattParser.AssemblyInfo.fs aborted
error: Checking of file /home/runner/work/fsharp-prattparser/fsharp-prattparser/PrattParser/obj/Debug/net8.0/PrattParser.Version.fs aborted
error: Checking of file /home/runner/work/fsharp-prattparser/fsharp-prattparser/PrattParser/Parser.fs aborted
info: No messages found from the analyzer(s)

In order not to have a heap of primitive types like _ list option, I pulled out the failure case into a single-case DU. That way, the semantics are much clearer if you're only looking at the type signatures.

Smaug123 commented 7 months ago

Personally I'm less concerned about documenting exit codes because we already log on all these error cases.

dawedawe commented 7 months ago

Personally I'm less concerned about documenting exit codes because we already log on all these error cases.

Thanks for the work. We can document the exit codes in another PR, then.

Smaug123 commented 7 months ago

Would you mind merging this please? I don't have permission to.

nojaf commented 7 months ago

@Smaug123 would you like a new release with all your latest changes?

Smaug123 commented 7 months ago

That would be great, thanks!

nojaf commented 7 months ago

Released https://www.nuget.org/packages/FSharp.Analyzers.SDK/0.24.0 (and subsequentially https://www.nuget.org/packages/G-Research.FSharp.Analyzers/0.8.0)

Smaug123 commented 7 months ago

Thanks - working perfectly (https://github.com/Smaug123/fsharp-prattparser/actions/runs/7708627409/job/21008123060?pr=2 now loudly fails rather than silently failing).