Improving code quality using the Roslyn Compiler API

Code quality is one of the main concerns in software development to make cooperation on large projects possible. Code needs to comply with certain standards that are defined specifically in a team. To enforce these rules, static code analysis is often used. It is usually done either by a third party tool or through code review by a team member. The .NET Compiler Platform, also called Roslyn, makes it possible to write powerful code analyzers that are integrated into the C# compiler. This way, rules are applied while writing code and suitable improvements can be suggested using code generation the moment mistakes happen. The code analyzer can also define rule transgressions as compiler errors, so that these rules have to be followed for the project to build. The code is only reviewed when no more rules are violated and team members can focus on different aspects in their code review. In this thesis, the usefulness of the Roslyn compiler API for improving code quality is evaluated. This is accomplished by the example of creating an analyzer that enforces name patterns in C# projects. The theoretical concepts behind name patterns are also described and explained.