DataGrip 2021.2 Help

Code Inspections in General

This topic lists all DataGrip code inspections available in General.

You can toggle specific inspections or change their severity level on the Editor | Inspections page of the IDE settings Ctrl+Alt+S.

InspectionDescriptionDefault Severity
Annotator

Reports problems that are found by language annotators in the result of a batch code inspection run.

Error Error
Duplicated code fragment

Reports duplicated blocks of code from the selected scope: the same file or the entire project. The inspection features quick-fixes that help you to set the size of detected duplicates, navigate to repetitive code fragments, and compare them in a tool window.

The inspection options allow you to select the scope of the reported duplicated fragments and set the initial size for the duplicated language constructs.

You can also configure the constructs that you want to anonymize in Preferences | Editor | Duplicates.

Weak Warning Weak warning
Inconsistent line separators

Reports files with line separators different from the ones that are specified in the project's settings.

For example, the inspection will be triggered if you set the line separator to \n in Settings | Editor | Code Style | Line separator, while the file you are editing uses \r\n as a line separator.

The inspection also warns you about mixed line separators within a file.

Disabled
Injected references

Reports unresolved references injected by Language Injections.

Example:

@Language("file-reference") String fileName = "/home/user/nonexistent.file"; // highlighted if file doesn't exist

Error Error
Problematic whitespace

Reports the following problems:

  • Tabs used for indentation when the code style is configured to use only spaces.

  • Spaces used for indentation when the code style is configured to use only tabs.

  • Spaces used for indentation and tabs used for alignment when the code style is configured to use smart tabs.



Disabled
Redundant suppression

Reports usages of the following elements that can be safely removed because the inspection they affect is no longer applicable in this context:

  • @SuppressWarning annotation, or

  • // noinspection line comment, or

  • /** noinspection */ JavaDoc comment



Example:
public class C { // symbol is already private, // but annotation is still around @SuppressWarnings({"WeakerAccess"}) true; void f() { CONST = false; } }

Warning Warning
Syntax error

Reports syntax errors that have been found in the result of a batch code inspection run.

Error Error
TODO comment

Reports TODO comments in your code.

You can configure the format for TODO comments in Settings | Editor | TODO. Since syntax highlighting for TODO comments is already provided, this inspection is efficient if you run it in the batch mode.

Disabled
The line is longer than allowed by code style

Reports lines that are longer than the right margin parameter specified in the Code Style settings.

Disabled
Last modified: 15 September 2021