navigation

InterpolatedStringWithNoSubstitution (FL0087)

Introduced in 0.26.8

Cause

Interpolated string (with $ prefix, such as $"foo") is used without embedded F# expression (e.g. $"{foo}" where foo is some value).

Or string formatting function such as sprintf or failwithf is used without interpolation.

Rationale

Usage of interpolated string without embedded F# expression(s) may indicate that the expression was intended to be used but wasn't used by mistake.

How To Fix

Use regular string or embed F# expression using curly braces ({}).

Use failwith instead of failwithf if no formatting/interpolation is needed.

Rule Settings

{
    "interpolatedStringWithNoSubstitution": {
        "enabled": true
    }
}