Repository navigation
0.41.0
Added
- A run where a project or script does not type check no longer looks clean outside the log. The SARIF report lists every type error as a
toolExecutionNotificationsentry and setsexecutionSuccessfultofalse. Pass--fail-on-type-errorsto also exit with code-5(TypeCheckFailed) in that case. The switch is opt-in, so a run that analyzes before building keeps its exit code. A#loador#rin a script that cannot be resolved counts as a type error too.
Changed
- Breaking:
Client.RunAnalyzersSafelyis nowClient.RunAnalyzers, and the oldClient.RunAnalyzers, which only returned the messages, is gone. It hid an analyzer that threw in the log, so a caller could not tell its messages were missing.RunAnalyzersreturns anAnalysisResultper analyzer and does not throw. To get only the messages, collect theOkoutputs. - Breaking:
AnalysisResult.Outputis nowResult<AnalyzerMessage list, exn>instead ofResult<Message list, exn>, so a caller keeps the name, help link and short description of the analyzer behind each message. Read.Messageon each item to get theMessageas before. - An error from loading a script, such as a
#loadthat cannot be resolved, is no longer logged at error level asScript ... has a diagnostic. It is logged with the type errors, as a warning underdid not type check, and each type error now names its file and error code. A warning from loading a script is still logged asScript ... has a diagnostic, but at warning level instead of error level.
Fixed
- File paths in the SARIF report and in
--output-format githubare relative to the code root. Without a trailing separator on--code-root(or the current directory, its default), every path started with the name of the code root directory, such asrepo/src/A.fsinstead ofsrc/A.fs. A code root with a trailing separator is unaffected. GitHub code scanning re-creates open alerts once at the corrected paths, because it ties an alert to its file path. --warnaserror, whichTreatWarningsAsErrorspasses to the compiler, is ignored when type checking for the analyzers, so a warning no longer counts as a type error.- An analyzer that throws no longer crashes the CLI. Its exception is logged, the other analyzers keep their messages, the SARIF report lists the failure as a
toolExecutionNotificationsentry withexecutionSuccessfulset tofalse, and the CLI exits with-4(AnalysisAborted). Previously the run stopped with exit code22, without a SARIF report and without the messages of the other analyzers. - An analyzer written as a function that throws before it returns its
Asyncnow reports its own exception, instead of aTargetInvocationExceptionwith the messageException has been thrown by the target of an invocation.
Special thanks to @nojaf!
https://www.nuget.org/packages/FSharp.Analyzers.SDK/0.41.0
https://www.nuget.org/packages/FSharp.Analyzers.SDK.Testing/0.41.0
https://www.nuget.org/packages/fsharp-analyzers/0.41.0