Header menu logo G-Research F# Analyzers

LoggingArgFuncNotFullyAppliedAnalyzer

Problem

As param arrays are loosely typed it's easy to miss a partially applied function in the display params of ILogger methods.

let f x y = x + y

do
    use factory = LoggerFactory.Create(fun b -> b.AddConsole() |> ignore)
    let logger: ILogger = factory.CreateLogger("Program")
    logger.Log(LogLevel.Information, "f returned: {0}", f 11)

Fix

Always apply all the arguments:

let f x y = x + y

do
    use factory = LoggerFactory.Create(fun b -> b.AddConsole() |> ignore)
    let logger: ILogger = factory.CreateLogger("Program")
    logger.Log(LogLevel.Information, "f returned: {0}", f 11 22)
val f: x: int -> y: int -> int
val x: int
val y: int
val factory: System.IDisposable
val ignore: value: 'T -> unit
val logger: obj

Type something to start searching.