maroontress / StyleChecker

StyleChecker is yet another code style checker and refactoring tool like FxCopAnalyzers, StyleCop Analyzers, SonarLint, Roslynator, and so on.

Home Page:https://maroontress.github.io/StyleChecker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

StyleChecker

StyleChecker is yet another code style checker and refactoring tool like FxCopAnalyzers, StyleCop Analyzers, SonarLint, Roslynator, and so on. It uses the .NET Compiler Platform ("Roslyn") to analyze the C# source code of .NET Core projects and outputs diagnostics of a rule violation, and when running with Visual Studio it provides code fixes as much as possible. Note that StyleChecker contains only supplemental or niche analyzers, so it is intended to be used together with other Roslyn analyzers.

Get started

StyleChecker is available as the NuGet-logo NuGet package.

Install StyleChecker to your project with Visual Studio

  1. Open Package Manager Console. (Open your project with Visual Studio, and select Tools ➜ NuGet Package Manager ➜ Package Manager Console.)
  2. Enter the command Install-Package StyleChecker in the Package Manager Console.
  3. Set all to the PrivateAssets property. (Open Solution Explorer and select your project ➜ Dependencies ➜ NuGet ➜ Click StyleChecker with a right button to open StyleChecker Package Properties, and then enter all to the PrivateAssets field.)

Install StyleChecker to your project with .NET Core CLI

  1. Enter the command dotnet add package StyleChecker with the console.
  2. Open your project file (.csproj) using a text editor like Visual Studio Code.
  3. Fix the PackageReference element in the project file adding the PrivateAssets attribute with the all value as follows:
<PackageReference Include="StyleChecker" Version="..." PrivateAssets="all" />

Diagnostics

See the list of diagnostics.

Customize configuration

Some analyzers can be customized to change their behaviors, placing the configuration file StyleChecker.xml at the project root. The XML Schema Definition file config.v1.xsd of the configuration file and a sample of the configuration file are provided in the directory StyleChecker/StyleChecker/nuget/samples/ of the source tree (or in ~/.nuget/packages/stylechecker/VERSION/samples/ if you installed StyleChecker with the NuGet package). Note that StyleChecker does not use the XML Schema Definition file, but it helps you edit StyleChecker.xml with the text editor that is able to validate XML documents (for example, Visual Studio IDE, Visual Studio Code, and so on).

Create your own StyleChecker.xml file and place it at your project root, and add the AdditionalFiles element to .csproj file in your project as follows:

<ItemGroup>
  <AdditionalFiles Include="StyleChecker.xml" />
</ItemGroup>

Alternatively, with Visual Studio you can set "C# analyzer additional file" to Build Action property (This property can be changed from Solution Explorer ➜ Right Click on the StyleChecker.xml ➜ Properties ➜ Advanced ➜ Build Action).

About

StyleChecker is yet another code style checker and refactoring tool like FxCopAnalyzers, StyleCop Analyzers, SonarLint, Roslynator, and so on.

https://maroontress.github.io/StyleChecker/

License:Other


Languages

Language:C# 99.5%Language:PowerShell 0.5%