Qodana Community for .NET
Qodana Community for .NET is a community linter based on ReSharper and provides static analysis for .NET projects. It brings all the smarts from ReSharper, which helps you:
Detect anomalous code and probable bugs
Eliminate dead code
Highlight spelling problems
Improve overall code structure
Introduce coding best practices
Upload inspection results to Qodana Cloud
Qodana Community for .NET lets you inspect .NET Core projects that use the C# and Visual Basic.NET (VB.NET) languages. It also supports C/C++ inspections for projects containing .sln
solution files.
Supported features
The Qodana Community for .NET linter provides the following Qodana features:
Feature | Available under the license |
---|---|
Community | |
Community |
Analyze a project locally
Prepare the project
If you plan to run Qodana Community for .NET on a local machine, make sure that Docker on this machine is up and running.
By default, Qodana tries to locate and employ a single solution file, or, if no solution file is present, it tries to find a project file. If your project contains multiple solution files, you need to specify the exact filename using the --solution
option and a relative path to a solution file. For example, to make Qodana always analyze the MySolution.sln
solution file, you can use:
Qodana Community for .NET requires the relative path to a solution or a project file from the repository root.
You can configure it in the qodana.yaml
file:
Alternatively, you can do it using the --solution
option:
If your project contains no solution files and multiple project files, you need to use the --project
option and a relative path to a project file. For example, for the MyProject.csproj
project file, you can save the following configuration to the qodana.yaml
file:
Alternatively, you can do it using the --project
option:
The Qodana Community for .NET does not support inspection configuration using the qodana.yaml
file. You can use .editorconfig
and .DotSettings
files for these purposes. Besides that, Qodana Community for .NET supports Roslyn analyzers, with each analyzer considered as a separate inspection. You can configure Roslyn analyzers using the .editorconfig
files. This is an experimental feature, so use them at your own risk.
Configure a solution
A solution configuration defines which projects in the solution to build, and which project configurations to use for specific projects within the solution.
Each newly created solution includes the Debug
and Release
configurations, which can be complemented by your custom configurations.
You can switch configurations of the current solution in the qodana.yaml
file:
Alternatively, you can do it using the --configuration
option:
By default, the solution platform is set to Any CPU
, and you can override it in the qodana.yaml
file:
Alternatively, you can do it using the --platform
option:
Build the project
When Qodana Community for .NET starts, it builds your project. If the project build fails, code analysis cannot be performed.
If you wish to run your custom build, use the --no-build
option while running the linter:
In this case, in the bootstrap
section of the qodana.yaml
file you can specify how to build your project, or run the build in a pipeline before passing it to Qodana.
Run the linter
Use this command to run the Dockerized version of the Qodana Community for .NET linter:
Here, the QODANA_TOKEN
variable specifies the project token. After Qodana finishes inspecting your code, you can open Qodana Cloud to see the inspection report.