{"id":114768,"date":"2021-02-11T12:49:11","date_gmt":"2021-02-11T11:49:11","guid":{"rendered":"https:\/\/blog.jetbrains.com\/?post_type=idea&#038;p=114768"},"modified":"2022-09-11T17:17:01","modified_gmt":"2022-09-11T16:17:01","slug":"early-access-program-for-qodana-a-new-product-that-brings-the-smarts-of-jetbrains-ides-into-your-ci-pipeline","status":"publish","type":"idea","link":"https:\/\/blog.jetbrains.com\/fr\/idea\/2021\/02\/early-access-program-for-qodana-a-new-product-that-brings-the-smarts-of-jetbrains-ides-into-your-ci-pipeline","title":{"rendered":"Early Access Program for Qodana, a New Product That Brings the \u201cSmarts\u201d of JetBrains IDEs Into Your CI Pipeline"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/idea_qodana2.png\" alt=\"qodana-banner\" width=\"800\" \/><\/p>\n<p>JetBrains IDEs are well known for their ability to understand code. They can track declarations, check references and types, and collect possible execution paths. Thanks to all this <strong>static analysis<\/strong>, you are able to rename and move things around safely, get appropriate code completion, and get warned with a message saying \u201chey, <em>this<\/em> won&#8217;t run\u201d from the <strong>code inspection<\/strong> if you are adding something that won\u2019t work into your code.<\/p>\n<p>Having all this while you are working in the editor is extremely helpful, but modern CI-centric workflows require having a reliable quality gate in your build pipeline. The multitude of tools being actively developed and used in this area clearly support this statement.<\/p>\n<p>It was technically possible to run JetBrains IDE <em>inspections<\/em> for the whole project in headless batch mode well before the CI era. However, integrating an IDE into the CI pipeline as a typical linter proved difficult.<\/p>\n<p><!--more--><\/p>\n<h2>Qodana is the solution<\/h2>\n<p>Qodana comprises two main parts: a nicely packaged GUI-less IntelliJ IDEA engine tailored for use in a CI pipeline as a typical \u201clinter\u201d tool, and an interactive web-based reporting UI.<\/p>\n<p>It makes it easy to set up workflows to get an overview of the project quality, set quality targets, and track progress on them. You can quickly adjust the list of checks applied for the project and include or remove directories from the analysis.<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-93606\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/qodana-exclude-preview.png\" alt=\"qodana-exclude-source-directory\" width=\"800\" data-gif-src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/qodana-exclude.gif\" \/><\/p>\n<p>The example above shows how to exclude a source directory or inspection category from the analysis. Another way to configure this is to use the <code>qodana.yaml<\/code> file. See the details <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\/qodana-yaml.html\" target=\"_blank\" rel=\"noopener\">in our user guide<\/a>.<\/p>\n<h2>Demo of popular projects<\/h2>\n<p>We\u2019ve created a playground for you to see Qodana in action for popular projects: OkHttp, Guava, ZXing, and a couple of others. Although the code in these projects may run on millions of machines daily, with the help of Qodana you can easily see what can be improved. It doesn&#8217;t mean that the code is bad, it just means that the technologies are evolving, the surroundings are changing, and we need to keep up.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/idea_ui-overview.png\" alt=\"qodana-ui-overview\" width=\"800\" \/><\/p>\n<p>In the example report above that was run on the ZXing project, you can see that there are 5 cases in 5 files where the condition has always the same result. You can click <em>Open in IDE<\/em> and apply quick-fixes to this code. As a result, the next developer who works with these files will be able to spend less time trying to work out why this condition is included and whether it is redundant or not.<\/p>\n<p>To open the sandbox playground, use the following link <a href=\"https:\/\/qodana.teamcity.com\/login.html\" target=\"_blank\" rel=\"noopener\">https:\/\/qodana.teamcity.com\/login.html<\/a>\u00a0and select the \u201clogin as guest\u201d option to explore the UI integrated into the JetBrains cloud CI, TeamCity. You can use the <a href=\"https:\/\/qodana.beta.teamcity.com\/buildConfiguration\/Hosted_Root_Java_ZXing\/17620?buildTab=Qodana&amp;locationFilters=NoXSA&amp;genericFilters=N4XyA&amp;orderedLevels=NoIgLg9hA2IDQgM4FMBuyBOBLMBPeIAxgIZjIDmEG%2BCeADsiALpA\" target=\"_blank\" rel=\"noopener\">Qodana tab<\/a> to see what problems it found, browse the list of inspections that it ran, and try out the different options for yourself. Once you have an idea of how it works and what you can do with it, then it\u2019s time to take the next step and try Qodana on your own project.<\/p>\n<h2>Using Qodana on your project<\/h2>\n<p>Qodana is packed into a ready-to-use Docker image. You can run it:<\/p>\n<ul>\n<li>By manually invoking it on your projects.<\/li>\n<li>By integrating it into your CI pipeline.<\/li>\n<li>Using GitHub Actions.<\/li>\n<li>Using GitHub Application.<\/li>\n<li>On JetBrains TeamCity standalone and Cloud.<\/li>\n<\/ul>\n<h3>Docker image<\/h3>\n<p>Pull the image from Docker Hub:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">docker pull jetbrains\/qodana<\/pre>\n<p>Run the command below, replacing <code>source-folder<\/code> with your project\u2019s root path and open the URL printed in the command line output to view the report.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"\">docker run -it -v &lt;source-folder&gt;\/:\/data\/project\/   \\\n-p 8080:8080 jetbrains\/qodana --show-report<\/pre>\n<p>You can find more information about the Docker image <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\/docker-readme.html\" target=\"_blank\" rel=\"noopener\">here<\/a>.<\/p>\n<h3>GitHub Actions<\/h3>\n<p>Qodana can run on any CI tool, but for simplicity let\u2019s take a look at how you can use it with the <em>Qodana &#8211; Code Inspection<\/em> GitHub action, which you can find on the <a href=\"https:\/\/github.com\/marketplace\/actions\/qodana-code-inspection\" target=\"_blank\" rel=\"noopener\">GitHub Marketplace<\/a>.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/idea_qodana-github-action-result.png\" alt=\"qodana-github-action\" width=\"800\" \/><\/p>\n<p>The <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\/github-overview.html\" target=\"_blank\" rel=\"noopener\">user guide<\/a> describes a simple, fully functional GitHub Actions workflow that uses the Docker image. Integration into other CIs can be achieved in a similar manner. You can control the execution by providing conditions via <code>qodana.yaml<\/code> and pass the results in JSON format to the next steps in your pipeline.<\/p>\n<h3>GitHub Application<\/h3>\n<p>We are working on a GitHub Application that will provide checks for pull requests in the repository where it is installed.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/idea_github-app.png\" alt=\"qodana-github-application\" width=\"800\" \/><\/p>\n<p>The screenshot above shows the Qodana result preview integrated in the GitHub checks sections.<\/p>\n<p>At the moment the application is working in a couple of JetBrains repositories: <a href=\"https:\/\/github.com\/JetBrains\/intellij-community\/pull\/1502\/checks\" target=\"_blank\" rel=\"noopener\">IntelliJ IDEA Community<\/a> and <a href=\"https:\/\/github.com\/JetBrains\/ideavim\/pull\/269\/checks\" target=\"_blank\" rel=\"noopener\">IdeaVim plugin<\/a>. If you want to have Qodana checks in your own GitHub repository, you can read how to do so <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\/github-overview.html\" target=\"_blank\" rel=\"noopener\">in our user guide<\/a>.<\/p>\n<h3>TeamCity<\/h3>\n<p>If you have your own on-premises installation of TeamCity, you can install <a href=\"https:\/\/plugins.jetbrains.com\/plugin\/15498-qodana\" target=\"_blank\" rel=\"noopener\">the Qodana plugin from JetBrains Marketplace<\/a>. After extending your build with Qodana, you\u2019ll get the following capabilities:<\/p>\n<ul>\n<li>An interactive report in a separate build tab.<\/li>\n<li>Compare problems and checks applied between builds.<\/li>\n<li>Report any problems discovered as standard TeamCity tests so that you can assign investigations to the appropriate team members.<\/li>\n<li>Use flexible build failure conditions.<\/li>\n<li>View aggregate statistics for static code analysis metrics.<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/blog.jetbrains.com\/wp-content\/uploads\/2021\/02\/idea_tc-plugin.png\" alt=\"qodana-teamcity-plugin\" width=\"800\" \/><\/p>\n<p>The screenshot above shows a report for failed inspections grouped by type. In this example, 5 problems related to <em>Constant Conditions &amp; Exceptions<\/em> were grouped together. You can also choose grouping by file or module, or create a separate assignable failed \u201ctest\u201d for every problem that is found.<\/p>\n<p>Read more about the Qodana TeamCity plugin <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\/teamcity-plugin.html\" target=\"_blank\" rel=\"noopener\">in the user guide<\/a>.<\/p>\n<h3>TeamCity Cloud<\/h3>\n<p>If you don\u2019t have TeamCity yet but would like to give it a try, you can quickly and easily create a <a href=\"https:\/\/www.jetbrains.com\/teamcity\/cloud\/\" target=\"_blank\" rel=\"noopener\">TeamCity Cloud instance<\/a>. Once you have one, contact us at <a href=\"mailto:qodana-support@jetbrains.com\">qodana-support@jetbrains.com<\/a> and we will install the latest version of the Qodana plugin in your instance.<\/p>\n<h2>What&#8217;s next?<\/h2>\n<p>We are working on a public roadmap to let you see in advance where things are going. Right now we\u2019re working on polishing all the features described above and developing many more, for example, revision\/branch comparison, high-level quality targets, an inspection profile exchange, cross-project analysis for code duplication, third-party license monitoring, and security checks including taint analysis.<\/p>\n<h2>Try it now<\/h2>\n<p>JetBrains Qodana is now available under an Early Access Program (EAP). During the EAP users will have full access to Qodana Docker, Qodana TeamCity Plugin, and Qodana GitHub Application free of charge. While we try to keep EAP releases stable, they have not undergone the same degree of testing as a full public release. There can be flaws and there will be rapidly evolving changes in the UI and configurations.<\/p>\n<p>Detailed instructions on how to start using Qodana are available <a href=\"https:\/\/www.jetbrains.com\/help\/qodana\" target=\"_blank\" rel=\"noopener\">in our documentation<\/a>. We will be grateful for any feedback, and any ideas are welcome! Contact us at <a href=\"mailto:qodana-support@jetbrains.com\">qodana-support@jetbrains.com<\/a> or via our <a href=\"https:\/\/youtrack.jetbrains.com\/issues\/QD\" target=\"_blank\" rel=\"noopener\">issue tracker<\/a>.<\/p>\n<p><em>Your JetBrains Qodana Team<br \/>\nThe Drive to Develop<\/em><\/p>\n","protected":false},"author":745,"featured_media":114805,"comment_status":"open","ping_status":"closed","template":"","categories":[826,4759,5088,89,890],"tags":[4702,600,40,91,6470],"cross-post-tag":[6687],"acf":[],"_links":{"self":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/idea\/114768"}],"collection":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/idea"}],"about":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/types\/idea"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/users\/745"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/comments?post=114768"}],"version-history":[{"count":10,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/idea\/114768\/revisions"}],"predecessor-version":[{"id":278287,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/idea\/114768\/revisions\/278287"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/media\/114805"}],"wp:attachment":[{"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/media?parent=114768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/categories?post=114768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/tags?post=114768"},{"taxonomy":"cross-post-tag","embeddable":true,"href":"https:\/\/blog.jetbrains.com\/fr\/wp-json\/wp\/v2\/cross-post-tag?post=114768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}