Skip to content

Commit

Permalink
Add notes on getting started.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 8, 2023
1 parent 51a83f8 commit bceef3e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
# Ionide.Analyzers

[![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Ionide.Analyzers?style=flat-square)](https://www.nuget.org/packages/Ionide.Analyzers/absoluteLatest)

An fsharp community project containing [analyzers](https://ionide.io/FSharp.Analyzers.SDK/).

## Getting started
## Running these analyzers

To run these analyzers you need to download the [fsharp-analyzers tool](https://www.nuget.org/packages/fsharp-analyzers) and this [NuGet package](https://www.nuget.org/packages/Ionide.Analyzers/absoluteLatest).
Learn more getting started in the [SDK documentation](https://ionide.io/FSharp.Analyzers.SDK/content/Getting%20Started%20Using.html) or follow this [quick start guide](https://ionide.io/ionide-analyzers/#Quick-start).

## Getting started contributing!

Run `dotnet fsi build.fsx` to perform a local CI build.
Otherwise run `dotnet tool restore` and `dotnet restore` to download all the dependencies.
Get started in no time using our [docs](https://ionide.io/ionide-analyzers/content/contributions.html)!

## Running the documentation

Expand Down
45 changes: 45 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,49 @@

Welcome to the Ionide Analyzers project.

## Quick start

In its simplest form, running analyzers requires running the [fsharp-analyzers tool](https://www.nuget.org/packages/fsharp-analyzers) and pass your `*.fsproj` and a folder that contains analyzers binaries.

```shell
# Create a new manifest if you don't have one
dotnet new tool-manifest

# Install the local tool
dotnet tool install fsharp-analyzers

# Execute the tool, run dotnet fsharp-analyzers --help for more options.
dotnet fsharp-analyzers --project ./src/MyProject.fsproj --analyzers-path /var/some-folder
```

Of course, the `--analyzers-path` is a bit tricky. We need to download the binary and find them somehow.

You can add a NuGet reference to your project:

```xml
<PackageReference Include="Ionide.Analyzers" Version="0.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
```

This will download the package to our local NuGet cache.
*But how do we find that local path?*

Starting `dotnet 8 RC 2`, we can [evaluate an MSBuild property](https://devblogs.microsoft.com/dotnet/announcing-dotnet-8-rc2/#msbuild-simple-cli-based-project-evaluation) which NuGet restore creates for us.

> dotnet build ./src/MyProject.fsproj --getProperty:PkgIonide_Analyzers
`PkgIonide_Analyzers` comes from the [{projectName}.projectFileExtension.nuget.g.props](https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#restore-outputs) file.

This can yield

> C:\Users\username\\.nuget\packages\ionide.analyzers\0.1.1
And we can use that path to pass to the tool:

> dotnet fsharp-analyzers --project ./src/MyProject.fsproj --analyzers-path C:\Users\username\\.nuget\packages\ionide.analyzers\0.1.1
## Contribute!

Learn how to [get started contributing]({{fsdocs-next-page-link}})!

0 comments on commit bceef3e

Please sign in to comment.