ionide / ionide/FSharp.Analyzers.SDK
Simplify setup
- Dominant language
- F#
- Stars
- 85
- Forks
- 28
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 20
Description
Let me start by explaining that I hardly can write any F# code, but as contributor to [.NET Project File Analyzers](https://dotnet-project-file-analyzers.github.io/) and [Buildalyzer](https://github.com/Buildalyzer/Buildalyzer) have some experience with MSBuild,
One of the users had issues to apply the .NET Project File Analyzers to his [F* only project](https://github.com/destructurama/fsharp/pull/126), and I gave it a try myself. So far so good; our analyzers analyze MSBuild files, and we have some rules targeting `.fsproj` file only that worked as they should.
While investigation further things to advise I stumbled on this project. I created [this issue](https://github.com/ionide/ionide-analyzers/issues/183), asking for some suggestions on what to advise to add to `.fsproj` files, in particular how to set up a project to correctly so that it runs the rules defined in `Ionide.Analyzers`. On of their contributors pointed me to both this repo and [some documentation](https://ionide.io/FSharp.Analyzers.SDK/content/getting-started/MSBuild.html).
When reading it, it make me wonder, could a lot of that quite complex setup be simplified by providing an `FSharp.Analyzers.SDK.props` and `FSharp.Analyzers.SDK.targets` file in the SDK package?
## FSharp.Analyzers.Build.props
Define some defaults
``` xml
true
true
```
## FSharp.Analyzers.Build.targets
Ensure a proper setup
``` xml
./
.
```
## G-Research.FSharp.Analyzers.targets (and similar for other analyzers)
As far as I understand, this extra flags are required per analyzer, so if we can reduce the clutter by let the package doing the heavy lifting that would be great.
``` xml
--analyzers-path "$(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs" --report "$(SarifOutput)$(MSBuildProjectName)-$(TargetFramework).sarif" --code-root $(CodeRoot)
```
As far as I know this hooks into MSBuild behavior, and not to Roslyn so it should all work for F#. Am I missing something? And if not, would this be a nice improvement that simplifies the setup of F# analyzers dramatically?
Also see https://github.com/dotnet-project-file-analyzers/dotnet-project-file-analyzers/issues/936
Contributor guide
Research direction
Start with the F# Analyzers SDK getting-started MSBuild documentation and the proposed FSharp.Analyzers.Build.props, FSharp.Analyzers.Build.targets, and analyzer-specific targets files in the issue. Check how AnalyzeFSharpProject, ProjectsToAnalyze, SarifOutput, CodeRoot, and FSharpAnalyzersOtherFlags are currently configured. Done means the SDK package can provide the shared setup and materially simplify configuring F# analyzers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100