Skip to content

Analyzers

Ranvier.Analyzers reports mistakes at their source ranges during a build. Each rule below has a triggering example and a corrected version.

CodeTitleSeverityScope
RAN001Fable inlines a snapshot of a module mutableWarningFable
RAN002Generated union case tester in a Fable libraryWarningFable
RAN010Owned node created in a pure derivationErrorRanvier
RAN011Async value created and read in the owner that replaces itWarningRanvier
RAN012Reactive read after the first await of an async memoWarningRanvier
RAN013Signal write or Pump on a thread-pool callbackWarningRanvier
RAN015CancelPrevious with a body that ignores its tokenHintRanvier
RAN020Reactive read at template build timeWarningview
RAN021Unstable list keyWarning / Infoview
RAN022Definition created on every region readWarningview
RAN023Invalid content parts on an elementErrorview
RAN024Markup the server render refusesWarningview
RAN025hydrateWith with queued commitsErrorview

Where the rules run

  • Ranvier rules run in a project that references Ranvier.

  • view rules run in a project that references Ranvier.View or Ranvier.View.Dom, or compiles their sources, such as the view projects of this repository.

  • Fable rules run in a project that Fable compiles. Every Ranvier project references Fable.Core, so the rules read the project's own signals instead:

    • a tool manifest (.config/dotnet-tools.json, searched upward to the first root manifest) that declares fable or fickl;
    • a Fable.* package reference in the project file;
    • <RanvierFableAnalyzers>true</RanvierFableAnalyzers>, for a global, --tool-path or dotnet dnx install of Fable.

    A .NET-only project gets neither RAN001 nor RAN002. RAN002 also needs a declared fable before 5.22, or no declared compiler.

Running the analyzers

In this repository, after dotnet build Ranvier.slnx -c Release:

dotnet fsi build.fsx -- analyze

The command builds the analyzers, treats findings as errors and writes reports to artifacts/analyzers. Set <RanvierAnalyze>true</RanvierAnalyze> to include findings in a project's dotnet build output.

Suppression

Write the reason on the line before the SDK's comment:

// The snapshot is read before any write, so Fable's inlining leaves the value unchanged.
// fsharpanalyzer: ignore-line-next RAN001
let setups = Loops.childSetups

ignore-line, ignore-region-start/ignore-region-end and ignore-file take the same codes.

Columns

The CLI's console output, and the dotnet build warnings made from it, count columns from 0: B.fs(4,8) is the identifier at the ninth character of line 4. The SARIF report, and the CI annotations made from it, count from 1.

Edit this page