Roslynator is a collection of code analyzers, refactorings and code fixes. It is a Roslyn-based equivalent of FxCop. To some extend it is a replacement for Resharper from JetBrains. Of course R# is much more powerfull, bur Roslyntor is also getting more and more traction recently.
How we can use it?
First step is to install Roslynator Visual Studio Extension. After this is done the yellow light bulb in Visual Studio will have extra hints for you. It will use Roslynator rules to provide you with code improvements. In the case below it proposes adding
static modifier to the class definition.
Similar to FxCop, Roslynator provides a way to enable/disable a rule, as well as change its severity.
It is also possible to break the build for if particular rules are violated. In the case below rule RCS1018 was changed from
After that we tick
Enable Code Analysis on Build on
Code Analysis page in project properties.
Now when we try to build the project it gets broken as following:
Roslynator provides a simple way to introduce code quality check in our C# code. It's a combination of R# refactoring features as well as FxCop rules. Given that the installation is very simple and intuitive it could be very easy introduced in our projects.