Skip to content

Commit

Permalink
Merge pull request ionide#121 from nojaf/docs/sarif
Browse files Browse the repository at this point in the history
Add basic documentation for CI support.
  • Loading branch information
nojaf authored Oct 17, 2023
2 parents 6108442 + 42dbcbe commit e31c6da
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/content/Running during CI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
category: end-users
categoryindex: 1
index: 5
---

# Running analyzers during continuous integration

Similar to unit tests and code formatting, analyzers are a tool you want to enforce when modifying a code repository.
Especially, in the context of a team, you want to ensure everybody is adhering to the warnings produced by analyzers.

## Command line options

Use the `--report` command line argument to produce a [sarif](https://sarifweb.azurewebsites.net/) report json.
Most *CI/CD* systems should be able to process this afterwards to capture the reported information by the analyzers.

Example usage:

```shell
dotnet fsharp-analyzers /
--project MyProject.fsproj /
--analyzers-path ./MyFolderWithAnalyzers /
--report ./analysis.sarif
```

### GitHub Actions

If you are using [GitHub Actions](https://docs.github.com/en/code-security/codeql-cli/using-the-advanced-functionality-of-the-codeql-cli/sarif-output) you can easily send the *sarif file* to [CodeQL](https://codeql.github.com/).

```yml
# checkout code, build, run analyzers, ...
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: analysis.sarif
```
Sample:
![Example](https://user-images.githubusercontent.com/2621499/275484611-e38461f8-3689-4bf0-8ab8-11a6318e01aa.png)
See [fsproject/fantomas#2962](https://github.com/fsprojects/fantomas/pull/2962) for more information.
[Previous]({{fsdocs-previous-page-link}})
1 change: 1 addition & 0 deletions docs/content/Unit Testing.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,5 @@ let notUsed() =

(**
[Previous]({{fsdocs-previous-page-link}})
[Next]({{fsdocs-next-page-link}})
*)

0 comments on commit e31c6da

Please sign in to comment.