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

Report analyzer problem in GitHub #2962

Merged
merged 16 commits into from
Oct 17, 2023
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"fsharp-analyzers": {
"version": "0.15.0",
"version": "0.16.0",
"commands": [
"fsharp-analyzers"
]
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,5 @@ tests/.repositories/**
!tests/.repositories/Directory.Build.props

# Analyzer files
.analyzerpackages
.analyzerpackages
analysis.sarif
2 changes: 1 addition & 1 deletion analyzers/analyzers.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageDownload Include="G-Research.FSharp.Analyzers" Version="[0.1.3]" />
<PackageDownload Include="G-Research.FSharp.Analyzers" Version="[0.1.4]" />
</ItemGroup>

</Project>
Expand Down
11 changes: 9 additions & 2 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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
Expand Down