Skip to content

Commit

Permalink
integration of analyzers (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
dawedawe authored Nov 26, 2023
1 parent c482f7e commit 3d96eda
Show file tree
Hide file tree
Showing 10 changed files with 516 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"commands": [
"fantomas"
]
},
"fsharp-analyzers": {
"version": "0.20.2",
"commands": [
"fsharp-analyzers"
]
}
}
}
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,23 @@ jobs:
env:
BuildNet7: ${{ matrix.build_net7 }}
BuildNet8: ${{ matrix.build_net8 }}

analyze:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Restore tools
run: dotnet tool restore

- name: Run analyzers
run: dotnet build -t:AnalyzeSolution -p:TargetFramework=net6.0

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: analysisreports
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ test/FsAutoComplete.Tests.Lsp/TestResults/

.tool-versions
BenchmarkDotNet.Artifacts/

*.sarif
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
</PropertyGroup>
</Target>

<PropertyGroup>
<SarifOutput Condition="$(SarifOutput) == ''">./</SarifOutput>
<CodeRoot Condition="$(CodeRoot) == ''">.</CodeRoot>
<FSharpAnalyzersOtherFlags>--analyzers-path &quot;$(PkgIonide_Analyzers)/analyzers/dotnet/fs&quot; --code-root $(CodeRoot) --report &quot;$(SarifOutput)/$(MSBuildProjectName)-$(TargetFramework).sarif&quot; --verbose</FSharpAnalyzersOtherFlags>
</PropertyGroup>

</Project>
16 changes: 16 additions & 0 deletions Directory.Solution.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,20 @@
<Target Name="CheckFormat">
<Exec Command="dotnet fantomas --check @(FormatInputs, ' ') " />
</Target>

<ItemGroup>
<ProjectsToAnalyze Include="src/**/*.fsproj" />
</ItemGroup>

<Target Name="AnalyzeSolution">
<PropertyGroup>
<CodeRoot>$(SolutionDir)</CodeRoot>
<SarifOutput>$(SolutionDir)/analysisreports</SarifOutput>
</PropertyGroup>
<MSBuild
Projects="@(ProjectsToAnalyze)"
Targets="AnalyzeFSharpProject"
Properties="CodeRoot=$(CodeRoot);SarifOutput=$(SarifOutput)" />
</Target>

</Project>
4 changes: 4 additions & 0 deletions paket.dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ lowest_matching: true
nuget BenchmarkDotNet 0.13.5
nuget Fantomas.Client >= 0.9
nuget FSharp.Compiler.Service >= 43.8.100
nuget Ionide.Analyzers 0.4.0
nuget FSharp.Analyzers.Build 0.2.0
nuget Ionide.ProjInfo >= 0.62.0
nuget Ionide.ProjInfo.FCS >= 0.62.0
nuget Ionide.ProjInfo.ProjectSystem >= 0.62.0
Expand Down Expand Up @@ -57,6 +59,8 @@ nuget OpenTelemetry.Exporter.OpenTelemetryProtocol >= 1.3.2 # 1.4 bumps to 7.0 v
nuget LinkDotNet.StringBuilder 1.18.0
nuget CommunityToolkit.HighPerformance
nuget System.Security.Cryptography.Pkcs 6.0.4
nuget System.Net.Http 4.3.4 # pinned for security reasons
nuget System.Text.RegularExpressions 4.3.1 # pinned for security reasons


group Build
Expand Down
459 changes: 455 additions & 4 deletions paket.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/FsAutoComplete.Core/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ Ionide.KeepAChangelog.Tasks
Microsoft.Extensions.Caching.Memory
Microsoft.CodeAnalysis
LinkDotNet.StringBuilder
CommunityToolkit.HighPerformance
CommunityToolkit.HighPerformance
Ionide.Analyzers
FSharp.Analyzers.Build
2 changes: 2 additions & 0 deletions src/FsAutoComplete.Logging/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ FSharp.Core

Microsoft.NETFramework.ReferenceAssemblies
Ionide.KeepAChangelog.Tasks
Ionide.Analyzers
FSharp.Analyzers.Build
4 changes: 3 additions & 1 deletion src/FsAutoComplete/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ Microsoft.Extensions.Caching.Memory
OpenTelemetry.Exporter.OpenTelemetryProtocol
Microsoft.CodeAnalysis
LinkDotNet.StringBuilder
CommunityToolkit.HighPerformance
CommunityToolkit.HighPerformance
Ionide.Analyzers
FSharp.Analyzers.Build

0 comments on commit 3d96eda

Please sign in to comment.