Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add Sarif output support to FSharpLint.Console #702

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Mar 10, 2024

refs #554

I've recently been having a go at running some things at work through the FSharp.Analyzers.SDK analysis tools and pushing the generated Sarif report files into DevOps CI builds, and I thought it might be useful to see if I could get FSharpLint results pushed out in the same way - so, this is a first attempt at adding Sarif report generation into FSharpLint.Console.

Note: The Sarif writer code is currently a lightly modified version of the report code from https://github.com/ionide/FSharp.Analyzers.SDK just to try to get it working, so if the code style and such is wrong that's the reason.

Microsoft.SourceLink.GitHub
Sarif.Sdk import_targets: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import_targets: false is because I was initially getting this error from builds after adding the nuget package reference:

Exec: EXEC(0,0): error : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Exec: C:\Users\Richard Webb\.nuget\packages\microsoft.diagnostics.tracing.eventregister\1.1.28\build\Microsoft.Diagnostics.Tracing.EventRegister.targets(132,5): error MSB3073: The command ""C:\Users\Richard Webb\.nuget\packages\microsoft.diagnostics.tracing.eventregister\1.1.28\build\eventRegister.exe" -DumpRegDlls @"S:\GitHubForks\FSharpLint\src\FSharpLint.Console\bin\Release\net6.0\dotnet-fsharplint.eventRegister.rsp" "S:\GitHubForks\FSharpLint\src\FSharpLint.Console\bin\Release\net6.0\dotnet-fsharplint.dll" " exited with code 1.

And I'm not sure why (I haven't used any of that eventregister stuff myself for years, and don't recall the defaults of it)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this info in the commit msg

@Numpsy
Copy link
Contributor Author

Numpsy commented Mar 10, 2024

It might also be possible to make it generate a sarif report from the SelfCheck runs in CI builds and push that into the Github code analysis integration, e.g. as done in FsAutoComplete:
https://github.com/fsharp/FsAutoComplete/blob/7d2d2ec851392fb7ed08b520a1be7782f24eb3be/.github/workflows/build.yml#L127

This is using the Microsoft Sarif.Sdk to write Sarif files.

The "import_targets: false" in paket.references is a workaround for this build error from a build task in the transitive microsoft.diagnostics.tracing.eventregister nuget package dependency.:

Exec: %packages%\microsoft.diagnostics.tracing.eventregister\1.1.28\build\Microsoft.Diagnostics.Tracing.EventRegister.targets(132,5): error MSB3073: The command ""%packages%\microsoft.diagnostics.tracing.eventregister\1.1.28\build\eventRegister.exe" -DumpRegDlls @"S:\GitHubForks\FSharpLint\src\FSharpLint.Console\bin\Release\net6.0\dotnet-fsharplint.eventRegister.rsp" "S:\GitHubForks\FSharpLint\src\FSharpLint.Console\bin\Release\net6.0\dotnet-fsharplint.dll" " exited with code 1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants