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

Add notes on getting started. #16

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
nojaf marked this conversation as resolved.
Show resolved Hide resolved

## 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}})!