Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
71 changes: 31 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,63 @@
# StyleChecker

StyleChecker is yet another code style checker and refactoring tool like
[FxCopAnalyzers][fxcopanalyzers],
[StyleCop Analyzers][stylecopanalyzers],
[SonarLint][sonarlint],
[Roslynator][roslynator],
and so on. It uses
[the .NET Compiler Platform ("Roslyn")](https://github.com/dotnet/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.
StyleChecker is another code style checking and refactoring tool similar to
[FxCopAnalyzers][fxcopanalyzers], [StyleCop Analyzers][stylecopanalyzers],
[SonarLint][sonarlint], [Roslynator][roslynator], etc. It uses the
[.NET Compiler Platform ("Roslyn")][roslyn] to analyze the C# source code of
.NET projects and outputs diagnostics of rule violations. And when used with
IDEs such as Visual Studio, it provides as many code fixes as possible. Note
that you should use this tool with other Roslyn analyzers, as it contains only
complementary or niche analyzers.

## Get started

StyleChecker is available as
[the ![NuGet-logo][nuget-logo] NuGet package][nuget-stylechecker].
StyleChecker is available as [the ![NuGet-logo][nuget-logo] NuGet
package][nuget-stylechecker].

### 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.)
select Tools ➜ NuGet Package Manager ➜ Package Manager
Console.)
2. Enter the command `Install-Package StyleChecker` in the Package Manager
Console.

### Install StyleChecker to your project with .NET Core CLI
### Install StyleChecker to your project with .NET CLI

1. Enter the command `dotnet add package StyleChecker` with the console.
- Enter the command `dotnet add package StyleChecker` with the console.

## Diagnostics

See [the list of diagnostics](doc/rules).

## 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).
You can customize some analyzers to change their behaviors by 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 available 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 can 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:
Create your own `StyleChecker.xml` file, place it at your project root, and add
the `AdditionalFiles` element to the `.csproj` file in your project as follows:

```xml
<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
&#x279c; Right Click on the `StyleChecker.xml`
&#x279c; Properties
&#x279c; Advanced
&#x279c; Build Action).
Alternatively, in Visual Studio, you can set the value "C# analyzer additional
file" to the Build Action property. You can change this property from Solution
Explorer &#x279c; Right Click on the `StyleChecker.xml` &#x279c; Properties
&#x279c; Advanced &#x279c; Build Action.

[roslyn]: https://github.com/dotnet/roslyn
[fxcopanalyzers]: https://github.com/dotnet/roslyn-analyzers
[stylecopanalyzers]: https://github.com/DotNetAnalyzers/StyleCopAnalyzers
[sonarlint]: https://github.com/SonarSource/sonarlint-visualstudio
Expand Down
4 changes: 2 additions & 2 deletions StyleChecker/StyleChecker.Test/StyleChecker.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@
<PackageReference Include="Maroontress.Oxbind" Version="1.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.8.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.8.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.2" />
<PackageReference Include="StyleChecker.Annotations" Version="1.0.1" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions StyleChecker/StyleChecker/StyleChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<PackageProjectUrl>https://maroontress.github.io/StyleChecker/</PackageProjectUrl>
<RepositoryUrl>https://github.com/maroontress/StyleChecker</RepositoryUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<Description>StyleChecker is yet another code style checker and refactoring tool like FxCopAnalyzers, StyleCop Analyzers, SonarLint, Roslynator, and so on.</Description>
<Description>StyleChecker is another code style checking and refactoring tool similar to FxCopAnalyzers, StyleCop Analyzers, SonarLint, Roslynator, etc.</Description>
<PackageReleaseNotes>See https://maroontress.github.io/StyleChecker/releasenotes.html</PackageReleaseNotes>
<Copyright>Copyright (c) 2018 Maroontress Fast Software</Copyright>
<PackageTags>csharp, visual-studio, roslyn, analyzer, roslyn-analyzer, roslyn-codefix, stylechecker</PackageTags>
<NoPackageAnalysis>true</NoPackageAnalysis>
<Version>2.1.0-beta</Version>
<Version>2.1.0</Version>
<RepositoryType />
<Company>Maroontress Fast Software</Company>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down