Skip to content

Commit e31c6da

Browse files
authoredOct 17, 2023
Merge pull request ionide#121 from nojaf/docs/sarif
Add basic documentation for CI support.
2 parents 6108442 + 42dbcbe commit e31c6da

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
 

‎docs/content/Running during CI.md

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
category: end-users
3+
categoryindex: 1
4+
index: 5
5+
---
6+
7+
# Running analyzers during continuous integration
8+
9+
Similar to unit tests and code formatting, analyzers are a tool you want to enforce when modifying a code repository.
10+
Especially, in the context of a team, you want to ensure everybody is adhering to the warnings produced by analyzers.
11+
12+
## Command line options
13+
14+
Use the `--report` command line argument to produce a [sarif](https://sarifweb.azurewebsites.net/) report json.
15+
Most *CI/CD* systems should be able to process this afterwards to capture the reported information by the analyzers.
16+
17+
Example usage:
18+
19+
```shell
20+
dotnet fsharp-analyzers /
21+
--project MyProject.fsproj /
22+
--analyzers-path ./MyFolderWithAnalyzers /
23+
--report ./analysis.sarif
24+
```
25+
26+
### GitHub Actions
27+
28+
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/).
29+
30+
```yml
31+
# checkout code, build, run analyzers, ...
32+
- name: Upload SARIF file
33+
uses: github/codeql-action/upload-sarif@v2
34+
with:
35+
sarif_file: analysis.sarif
36+
```
37+
38+
Sample:
39+
40+
![Example](https://user-images.githubusercontent.com/2621499/275484611-e38461f8-3689-4bf0-8ab8-11a6318e01aa.png)
41+
42+
See [fsproject/fantomas#2962](https://github.com/fsprojects/fantomas/pull/2962) for more information.
43+
44+
[Previous]({{fsdocs-previous-page-link}})

‎docs/content/Unit Testing.fsx

+1
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ let notUsed() =
6969

7070
(**
7171
[Previous]({{fsdocs-previous-page-link}})
72+
[Next]({{fsdocs-next-page-link}})
7273
*)

0 commit comments

Comments
 (0)
Please sign in to comment.