Qodana logo

Qodana

The code quality platform for teams

JavaScript Python Releases

Qodana 2022.2 Is Available: CircleCI Orb and 50+ New Inspections

Read this post in other languages:

Qodana 2022.2 is now available! We’ve added CircleCI Orb to the Qodana integration toolset, and brought new and improved code inspections for Java, Kotlin, Android, PHP, JavaScript, and Python.

GET STARTED WITH QODANA

More CIs to run Qodana with

Qodana already has plugins for Azure Pipelines, GitHub Actions, and TeamCity. Starting from 2022.2, we’ve prepared a CircleCI Qodana orb that allows you to set up code inspections quickly and easily with your CircleCI projects.  

Also, it’s easy to set up Qodana in GitLab, Jenkins, or any other CI that supports running Docker images.

New inspections

Regular expressions

Regular expressions are widely known for their complexity, intricate syntax, and sometimes verbosity. To make life easier, we’ve added new inspections in this area. Previously these inspections were available only for Java, but we’ve now made them available for all languages. 

Simplified regular expressions

A regular expression like [\wa-z\d] can be simplified to just \w since \w already includes a-z as well as the digits.  It helps improve the code’s overall readability.

Suspicious backreferences 

A regular expression like \1(abc) cannot match anything. This is because the \1 refers to the abc that is not yet defined when evaluating the \1. This inspection prevents simple typos in regular expressions and speeds up the editing experience. 

Redundant \d, [:digit:], or \D class elements

The regular expression [\w+\d] can be written as [\w+], as the \w already includes the \d. It helps improve the code’s overall readability.

Markdown support

Incorrectly numbered list items

Ordered list items like 1. 2. 4. are marked as being inconsistently numbered. In the rendered Markdown, the list is still displayed as 1. 2. 3., but the inconsistency makes editing the source code harder.

Java, Kotlin, and Android inspections

We’ve added and reorganized inspections in the categories: Javadoc, DevKit, Markdown, Kotlin language, style, architectural patterns, performance, and JUnit support. Here are a couple of examples from the JUnit set.

JUnit: Malformed Declaration

Reports the JUnit test member declarations that are malformed and are likely not to be recognized by the JUnit test framework. Declarations like these could result in unexecuted tests or lifecycle methods.

JUnit: Unconstructable TestCase

Reports JUnit test cases that can’t be constructed because they have an invalid constructor. Test cases like these will not be picked up by the JUnit test runner and will therefore not execute.

Those examples you can see live on our public TeamCity instance. Please use the Guest login to enter. Other inspections are described in our documentation.

PHP inspections

We added inspections in Probable bugs, Documentation, Style, Testing, and Laravel categories, for example:

Probable bug: Number ranges mismatch

In a function that is declared with returns int<0,10>, marks return statements that return a number outside this range. Similarly for fields, field constructors and function calls. 

Documentation: Type tag without variable name

The PHPDoc snippet @param string is redundant as it doesn’t say what is a string. It should be either removed or replaced with @param string $argument, saying that argument is a string. 

Blade: Parse error due to unpaired parentheses in string literals

Early detection of unpaired parentheses in string literals that are later parsed by Blade, a template engine.

To include or 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 or best practices. Check out our Qodana documentation for more information. 

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 qodana-support@jetbrains.com.

Your Qodana team

image description