Skip to content

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.

@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

@Numpsy
Copy link
Contributor Author

Numpsy commented Jul 2, 2025

Rebased on top of the latest code (The Paket changes are gone now, so previous comments about that don't apply any more

Copy link
Collaborator

@xperiandri xperiandri left a comment

Choose a reason for hiding this comment

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

Looks good, use object initializers, please

@Numpsy
Copy link
Contributor Author

Numpsy commented Jul 9, 2025

Rebased to fix conflicts, haven't got to the other comments yet.

@xperiandri
Copy link
Collaborator

Resolves #554

This is using the Microsoft Sarif.Sdk to write Sarif files.
let result =
Result(
RuleId = reportDescriptor.Id,
Level = FailureLevel.Warning,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there aren't different levels for different rules, should the default here be Warning or Note?

@Numpsy Numpsy changed the title WIP: Add Sarif output support to FSharpLint.Console Add Sarif output support to FSharpLint.Console Aug 23, 2025
@Numpsy
Copy link
Contributor Author

Numpsy commented Aug 23, 2025

Any other comments on the general idea?
(It'll need some documentation somewhere, but I want to get the idea checked before spending time on that)

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.

3 participants