MichaelGlass.FSharp.Analyzers 0.1.0-alpha.2

This is a prerelease version of MichaelGlass.FSharp.Analyzers.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MichaelGlass.FSharp.Analyzers --version 0.1.0-alpha.2
                    
NuGet\Install-Package MichaelGlass.FSharp.Analyzers -Version 0.1.0-alpha.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MichaelGlass.FSharp.Analyzers" Version="0.1.0-alpha.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MichaelGlass.FSharp.Analyzers" Version="0.1.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="MichaelGlass.FSharp.Analyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MichaelGlass.FSharp.Analyzers --version 0.1.0-alpha.2
                    
#r "nuget: MichaelGlass.FSharp.Analyzers, 0.1.0-alpha.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MichaelGlass.FSharp.Analyzers@0.1.0-alpha.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MichaelGlass.FSharp.Analyzers&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MichaelGlass.FSharp.Analyzers&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Tool

MichaelGlass.FSharp.Analyzers

F# analyzers that catch bugs the compiler can't: silent exception swallowing, hidden match cases, raw SQL, and missing error reporting.

Built on FSharp.Analyzers.SDK. Configured via .editorconfig. Every diagnostic can be suppressed inline with // {CODE}:ok.

Install

dotnet add package MichaelGlass.FSharp.Analyzers

Then enable the SDK in your editor or CI.

Analyzers

Code Name What it catches Why it matters Config
MGA-WILDCARD-001 Wildcard on DU | _ -> on discriminated unions New union cases silently fall into the catch-all instead of producing a compiler warning mga_wildcard_allowed_types
MGA-TASK-IGNORE-001 Task Ignore Task.Run(...) \|> ignore Exceptions in the ignored task vanish — no crash, no log, no trace (always on)
MGA-RAWSQL-001 Raw SQL String literals starting with SQL keywords Raw SQL is injection-prone, invisible to the type system, and breaks silently on schema changes mga_rawsql_excluded_files
MGA-ERROR-REPORT-001 Error Reporting try/with blocks missing an error-reporting call Silent catches hide production failures from your observability stack mga_error_reporting_functions
MGA-UNSAFE-CALL-001 Restricted Call Banned functions, banned call patterns, unsafe dynamic args Project-specific guardrails for dangerous APIs (XSS, concurrency, etc.) mga_banned_functions, mga_banned_call_patterns, mga_unsafe_dynamic_arg_functions

Always-on analyzers

Wildcard on DU and Task Ignore and Raw SQL are enabled by default. Option, Result, and Choice types are allowed by the wildcard analyzer — add more via .editorconfig:

[*.fs]
mga_wildcard_allowed_types = MyApp.ParseResult, MyApp.Token
mga_rawsql_excluded_files = Migrations.fs

Opt-in analyzers

Error Reporting and Restricted Call do nothing until configured:

[*.fs]
# Error Reporting: require these functions in every catch handler
mga_error_reporting_functions = captureError, logError

# Restricted Call: ban specific functions
mga_banned_functions = Task.WhenAll, Thread.Sleep

# Restricted Call: ban function + argument combinations
mga_banned_call_patterns = Attr.type':submit

# Restricted Call: flag non-literal args to injection-sensitive functions
mga_unsafe_dynamic_arg_functions = Text.raw, Html.rawText

Suppression

Add // {CODE}:ok on the flagged line or the line above:

match shape with
| Circle r -> drawCircle r
| _ -> drawDefault () // MGA-WILDCARD-001:ok — fallback is intentional here

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.8 56 9/29/2026
0.1.0-alpha.7 106 9/26/2026
0.1.0-alpha.6 114 9/20/2026
0.1.0-alpha.5 511 8/19/2026
0.1.0-alpha.4 240 6/25/2026
0.1.0-alpha.3 77 6/24/2026
0.1.0-alpha.2 81 6/24/2026
0.1.0-alpha.1 174 4/13/2026