Open nojaf opened 6 months ago
Interesting - probably yes, but one I would prefer to have would be "not all templated args have been given values".
That would be something like warn for logger.Log(LogLevel.Information, "foo {p} {x}", p)
because there is no value for x
?
That would be something like warn for
logger.Log(LogLevel.Information, "foo {p} {x}", p)
because there is no value forx
?
Yes, exactly.
There's a whole family of these sort of things in NetAnalyers, e.g. https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca2254 https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca2017 https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca2253
Also - some related things in this Serilog Analyzer - https://github.com/Suchiman/SerilogAnalyzer#serilog003-property-binding-verifier
(I don't know if there's any general view on porting Roslyn analyzers, or how such things should be grouped.)
Related to https://g-research.github.io/fsharp-analyzers/analyzers/LoggingArgFuncNotFullyAppliedAnalyzer.html Would it be interesting to also have an analyzer that detects a log call with a single interpolated string? Instead of using the log message template.
Would do you think @Smaug123?