DeepScan for IntelliJ

DeepScan provides a plugin which enables you to see bugs and quality issues on the fly in your IntelliJ and WebStorm.

Overview

DeepScan for IntelliJ helps you to see bugs and quality issues on the fly in your IntelliJ and WebStorm. Once you enable it for the project, the builder is added and analyzes the project.

  • Report issues in the editor on the fly (on typing).
  • Integrate with Inspection Results view for the whole project.
  • Highlight issues in the code.
  • Easy rule settings.
IntelliJ plugin

Requirements

Operating System

  • Windows
  • Linux

IDE

  • IntelliJ IDEA 2018 (We recommend version 2018.3 or above due to the error level in Code Inspection)
    • Version 2018.1: All issues marked as a warning level regardless of the impact.
    • Version 2018.2: High and medium-impact issues marked as an error level. Low-impact issues marked as a weak warning level.
    • Version 2018.3: High and medium-impact issues marked as an error level. Low-impact issues marked as a warning level.
  • IntelliJ IDEA 2019
  • WebStorm

Java

  • Oracle JRE 8 and above
  • OpenJDK 8 and above

Installation

Installing the plugin

The APIs between IntelliJ IDEA 2018 and 2019 are incompatible, so the DeepScan plugin is provided separately for each version. Please install the plugin for your IDE version. For example, users of version 2019 should install idea-2019-intellij-deepscan-plugin-XXX.zip.

In File > Settings > Plugins settings, click Install Plugin from Disk... menu and select the DeepScan plugin (*.jar or *.zip).
Install Plugin from Disk

The plugin will be installed after restarting the IDE. You can see the installed plugin in Plugins.
Plugins

Registering the license

A license key is required to run the IntelliJ DeepScan plugin. If a valid license key is not registered, license errors will occur when executing the analysis.

In File > Settings > Language & Frameworks > JavaScript > Code Quality Tools > DeepScan (Global) settings, enter and save the license key in the License field.
License

Upgrading

With an upgraded plugin file, follow the same process as installing.

Uninstalling

In File > Settings > Plugins settings, select the DeepScan plugin. Then, press Delete key or select Uninstall menu from the pop-up menu.

The plugin will be uninstalled after restarting the IDE.

Analysis

Analyzing a project

DeepScan plugin works based on IntelliJ's Code Inspection.

It supports both the local and global inspection, so you can instantly analyze your code as you type and even analyze your entire project.

  • Analyzing an entire project: When you click Analyze > Inspect Code... menu
  • Analyzing a file on-the-fly: When you type in the editor

Analysis Target

For detailed information about the analysis target, refer to the following:

Inspect Project

You can also analyze a whole project rather than a file on-the-fly.

  1. Click Analyze > Inspect Code... menu.
  2. Select the Inspection scope and click OK button.
    Inspect Code
  3. You can see the analysis results in JavaScript > Code Quality Tools > DeepScan under Inspection Results view.
    Inspection Results

Running DeepScan only

As of Code Inspection, other inspection tools are also executed, so that the analysis can take a long time. If you want to run DeepScan only, you can create a separate inspection profile for it.

  1. Click ... button in Inspection profile.
    Running DeepScan only
  2. Click Duplicate... menu to create a new profile cloning the current profile, and enter a name.
    Running DeepScan only
  3. Click Reset to Empty button to disable all inspection tools.
    Running DeepScan only
  4. Only check the DeepScan inspection (you can filter by typing deepscan) and click OK button.
    Running DeepScan only
  5. Inspect a project with this new profile.
    Running DeepScan only

Settings

DeepScan for IntelliJ provides project-specific settings in File > Settings > Language & Frameworks > JavaScript > Code Quality Tools > DeepScan.
IntelliJ Settings

Enable

Enable or disable DeepScan inspection for the project.

Ignore Rules

You can choose the rules to exclude for the analysis in the project settings.

Find the rules to exclude, uncheck those, and click OK button. Afterwards, the analysis will ignore the rules.

Export and Import Rules

In the toolbar menu under the rule settings, you can export the rule set in use and import it from a file.

By sharing the exported file, you can share your own rule set with other people.

  • Export: Click Export Rules button and specify a directory to export the file. Currently selected rule set is saved as a DeepScan_rules.json file.
  • Import: Click Import Rules button and select the exported file (*.json). Rule set in a file is applied.

Ignore Patterns

You can specify patterns of files to exclude.

It is a comma-separated paths, and each pattern follows the gitignore format. For example of App.vue,lib/, App.vue file and lib directory are excluded from the analysis.

After the patterns is set, the files or directories will be ignored when inspecting the project.

You can apply these ignore patterns also for ESLint by selecting Apply also to ESLint checkbox.

ESLint

Run ESLint. You can see the ESLint alarms altogether with DeepScan's issues.

Node.js and eslint package are required in the local or global. Note that NODE_PATH environment variable is necessary to load the eslint module installed in global.

It directly uses the package so your custom configurations and plugins are applied as is.

  • Enable: Enable or disable ESLint.
  • Merge option: Option for how identical issues of DeepScan and ESLint are merged. (defaults to deepscan)
    • Prefer DeepScan rule: Show only DeepScan issues
    • Prefer ESLint rule: Show only ESLint issues
    • Do not merge: Show all issues as is
  • Node interpreter: Specify Node.js executable when you don't have it in the PATH.

Other Convenient Functions

Disabling Rules with Inline Comments

While you can exclude project-wide rules via Settings, you can also disable a rule in a file using inline comment.

The below example is about disabling all rules for a line via deepscan-disable-line comment.
Disabling Rules with Inline Comments

For detailed information, refer to Disabling rules.

Code Completion

You can enter inline comments more conveniently through code completion.

When you type an inline comment and press Ctrl + Space key, DeepScan suggests the suppress comments. When you select one, it is automatically entered.
Code Completion

Quick Fix

You can also enter inline comments through Quick Fix for DeepScan issues.

When you press Alt + Enter key in DeepScan issues, some quick fixes are suggested. Select Ignore this rule <rule>, then the inline comment disabling the rule is automatically entered.
Quick Fix Quick Fix

Auto Fix (Experimental)

DeepScan has a long roadmap to provide an auto fix feature, which automatically modifies the non-compliant code into compliant one.

As an experiment, the plugin provides a simple auto fix for the two rules:

Rule Fix Action
ASSIGN_SAME_VALUE Remove the assignment
Auto Fix
BAD_ASSIGN_TO_CONST Change const to var / Remove the assignment
Auto Fix