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

Add basic documentation for CI support. #121

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}})
*)