diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index c06a1d3d19..351f64c64a 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "fsharp-analyzers": { - "version": "0.15.0", + "version": "0.16.0", "commands": [ "fsharp-analyzers" ] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d5cf1505f0..02e011c0d8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,11 @@ jobs: - name: "trigger fantomas-tools action" if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' run: "curl -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token ${{secrets.FANTOMAS_TOOLS_TOKEN}}' --request POST --data '{\"event_type\": \"fantomas-commit-on-main\"}' https://api.github.com/repos/fsprojects/fantomas-tools/dispatches" + - name: Upload SARIF file + uses: github/codeql-action/upload-sarif@v2 + if: matrix.os == 'ubuntu-latest' + with: + sarif_file: analysis.sarif - name: "Documentation" if: matrix.os == 'windows-latest' && github.ref == 'refs/heads/main' uses: peaceiris/actions-gh-pages@v3 diff --git a/.gitignore b/.gitignore index 540163f3d6..c5ba351d1f 100644 --- a/.gitignore +++ b/.gitignore @@ -200,4 +200,5 @@ tests/.repositories/** !tests/.repositories/Directory.Build.props # Analyzer files -.analyzerpackages \ No newline at end of file +.analyzerpackages +analysis.sarif \ No newline at end of file diff --git a/analyzers/analyzers.fsproj b/analyzers/analyzers.fsproj index f7d71ded5a..0df7286cec 100644 --- a/analyzers/analyzers.fsproj +++ b/analyzers/analyzers.fsproj @@ -10,7 +10,7 @@ - + diff --git a/build.fsx b/build.fsx index 90796db874..10f52011ef 100644 --- a/build.fsx +++ b/build.fsx @@ -67,7 +67,14 @@ let analyzersVersion = matches.Groups[1].Value let analyzeProjects (projectPaths: string seq) = - $"""dotnet fsharp-analyzers --project {String.concat " " projectPaths} --analyzers-path ./.analyzerpackages/g-research.fsharp.analyzers/{analyzersVersion} --verbose --fail-on-warnings GRA-STRING-001 GRA-STRING-002 GRA-STRING-003 GRA-UNIONCASE-001""" + let projects = String.concat " " projectPaths + let analyzerPath = + $"./.analyzerpackages/g-research.fsharp.analyzers/{analyzersVersion}" + let failOnWarnings = + "GRA-STRING-001 GRA-STRING-002 GRA-STRING-003 GRA-UNIONCASE-001" + let excludeAnalyzers = "PartialAppAnalyzer" + let report = "./analysis.sarif" + $"dotnet fsharp-analyzers --project %s{projects} --analyzers-path \"%s{analyzerPath}\" --verbose --fail-on-warnings %s{failOnWarnings} --report %s{report} --exclude-analyzer %s{excludeAnalyzers}" pipeline "Build" { workingDir __SOURCE_DIRECTORY__ @@ -87,7 +94,7 @@ pipeline "Build" { ) } stage "CheckFormat" { run "dotnet fantomas src docs build.fsx --check" } - stage "RestoreAnalyzers" { run $"dotnet restore {analyzersProjectPath}" } + stage "RestoreAnalyzers" { run $"dotnet restore %s{analyzersProjectPath}" } stage "Build" { run "dotnet build -c Release" } stage "Analyze" { envVars