Qodana for .NET
Qodana for .NET is based on Rider and provides static analysis for .NET projects. It brings all the smarts from Rider, which help you:
Detect anomalous code and probable bugs
Eliminate dead code
Highlight spelling problems
Improve overall code structure
Introduce coding best practices
Analyze a project locally
Install project dependencies
Qodana for .NET is suitable for analyzing .NET Core projects and provides the following SDK versions:
3.1.425
6.0.403
7.0.100
All SDK versions are stored in the /usr/share/dotnet/sdk directory of the Qodana for .NET container filesystem.
In case a project requires a different version of the SDK, you can set it up before running the analysis using the bootstrap field in the qodana.yaml file. For example, this command will install the required version of the SDK that is specified in the global.json file and located in the root of your project:
Run analysis
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 file name using the --property option. For example, to make Qodana always analyze the MySolution.sln solution file, you can use:
Alternatively, you can specify the solution file name in the qodana.yaml file using the solution option:
If you project contains no solution files and multiple project files, you need to specify the exact file name of a project. For example, for the MyProject.csproj project file it can be:
Alternatively, you can specify the project file name in the qodana.yaml file using the project option:
Qodana provides two options for local analysis of your code. Qodana CLI is the easiest option to start. Alternatively, you can use the Docker command from the tab.
Assuming that you have already installed Qodana CLI on your machine, you can run this command in the project root directory:
To start, pull the image from Docker Hub (only necessary to get the latest version):
Start local analysis with source-directory pointing to the root of your project:
Open http://localhost:8080 in your browser to examine inspection results. Here, you can also reconfigure the analysis, see the User interface overview section for details. When done, you can stop the web server by pressing Ctrl-C in the console.