Qodana 2022.3 EAP Is Out: Qodana for .NET and Go and 100+ New Inspections
We’re delighted to announce the release of Qodana 2022.3 EAP. This version of the platform brings support for .NET and Go. We’ve also added over 100 new inspections for the languages that were already supported. However, Qodana 2022.2 images are more stable, as Qodana 2022.3 EAP is still in its infancy.
Read on to learn more and become an early adopter of some exciting new features!
Our brand new linters bring all of the smarts from Rider and GoLand to enable you to spot anomalous code and potential bugs, eliminate dead code, improve the overall code structure, and introduce coding best practices across all of your .NET and Go projects!
Qodana for .NET
Qodana supports almost all .NET inspections provided by Rider. Since there’s a long list of them, check out the Rider documentation to learn more about all of the inspections. Meanwhile, a few examples of the .NET inspections that Qodana can run are below.
Inconsistent lock ordering
One of the main issues when using locks to achieve thread safety is avoiding deadlocks, i.e. when threads simultaneously block each other from continuing execution, so no progress is made. With this new inspection, Qodana will highlight cycles leading to possible deadlocks at runtime.
Access to modified captured variable
Qodana for .NET detects access to the captured variable from an anonymous method when the variable is modified externally.
Avoid using ‘async’ lambda when delegate type returns ‘void’
This inspection spots the usage of ‘async’ lambda expressions: any exceptions unhandled by the lambda will never affect the caller thread and will not be caught with the catch clause.
Type check and casts can be merged
is operator in its classical form
(Expression is Type) returns
true only when the runtime type of
Expression is compatible with
Type and the result of
Expression is not
When we use
is to check the compatibility before casting, like in the example below, we encounter at least two problems:
- We perform the type check twice for no reason, which can affect performance if we do it inside a loop.
- The fact that the program execution will not get into the
nullis not immediately clear to those who read this code.
Qodana will spot this issue and suggest you fix it right in Rider.
Lambda expression/anonymous method should not have captures of the containing context
The lambda expression/anonymous method passed to a parameter annotated by the ‘[RequireStaticDelegate]’ attribute must not have captures of the containing context (local variables, local functions, ‘this’ reference) to avoid heap allocations.
To configure the linter for .NET and run analysis, please refer to the Qodana documentation.
Qodana for Go
Qodana 2022.3 is designed to support all inspections provided by GoLand. To see the exhaustive list, please refer to the GoLand documentation. Below are examples of some of the Go inspections that Qodana now supports.
Placeholder argument ‘d.DeletedCount’ has the wrong type ‘int64’ (%s)
This inspection reports incorrect usages of
fmt.Println, and similar formatting and printing functions.
In their format strings, formatting functions use formatting verbs, like
%v, and others.
If formatting verbs are used incorrectly, the result of a formatting function will contain an error.
This inspection reports calls to functions and methods that do not handle the call result of the
An API of such functions implies that their execution might finish unsuccessfully and they would return an error. Calls that do not handle the error result could be an indication of misuse of the API.
This inspection reports unused dependencies on your project. It’s good practice to scan for unused dependencies on a regular basis, as it reduces the library size of your project and improves maintainability.
To see Qodana in action and play around with these new inspections, feel free to jump into our documentation and see how to configure linters for Go.
Besides adding new linters for .NET and Go, Qodana 2022.3 also brings you over 100 new inspections for the existing linters. Let’s take a look at the most prominent examples of inspections for Java, Kotlin, and Python.
Java and Kotlin inspections
We’ve added over 40 new inspections to Qodana for JVM Community and Qodana for JVM.
This inspection reports code constructs that always violate nullability contracts, may throw exceptions, or are redundant, based on data flow analysis.
Java 15 introduced the string escape sequence \s to make trailing whitespace in text-blocks visible. In most other contexts, especially in regular expressions, this escape sequence can easily be confused with the
\s of a regular expression meaning whitespace. In Java string literals it has to be written as
This inspection reports cases in which the Javadoc of a method obviously contradicts the method signature, such as the comment saying “returns true” when the method returns a string.
This inspection reports declarations in Kotlin that can be destructured.
Now Qodana can detect inconsistent method declarations in REST services (such as
@PathParam parameters that don’t match a placeholder from the
@Get annotation), as these would throw exceptions at runtime.
This new inspection spots
throw statements in Reactor/RxJava operator code instead of returning designated error values, which prevents the errors from being processed further. For example, it ignores them or replaces them with a fallback value.
Please, note that this version of Qodana also brings all of the new inspections for Android from IntelliJ IDEA 2022.3 and Android Studio – Electric Eel | 2022.1.1.
We’ve also added some inspections for the Google App Engine to Qodana for Python that will highlight issues before they cause failures in production environments. For example, now you can spot:
- GQL queries that do not comply with restrictions for queries allowed on the Google App Engine server.
- GQL queries without indexes.
- Usages of Python features that are restricted by the Google App Engine sandbox.
- Сases when threadsafe is not enabled with the CGI handler.
To exclude certain inspections from your analysis, you can customize your default inspection profile or create a brand new one. You may also want to enforce inspections that are important to your coding guidelines. Check out our Qodana documentation for more information.
That’s everything about Qodana 2022.3 EAP! We hope you enjoy this new release. If you have any suggestions for future blog topics or if you want to learn more about how Qodana can help you and your business, post a comment here, tag us on Twitter, or contact us at firstname.lastname@example.org.
Happy developing and keep your code clean!
Your Qodana team
Subscribe to Blog updates
Thanks, we've got you!