Code Inspections inside the IDE are used to highlight probable errors by analyzing the structure and content of your code. They run in the background automatically and issue warnings that help you to write correct Wolfram Language code. Each inspection has a definite purpose and can be adjusted or turned off easily. You can find the settings for all Wolfram Language inspections by navigating to File | Settings | Editor | Inspections | Wolfram Language.

The listing there shows all available inspections and contains a description of what they do. Below, you find a more detailed description of two specific ones that gives you more insight on how inspections work.

Some inspections come with so-called Quick Fixes which means they can automatically be corrected. One of these is the “Missing Semicolon” warning that enforced the usage of a semicolon after each expression (e.g., function definition) at file level. When your cursor is at the place of the warning, a small light bulb appears on the left-hand side. Pressing Alt+Enter opens a pop-up window which lets you insert the semicolon automatically. The important part is that you can select “fix all” which will correct all missing semicolons in the current file.

Note that you can use the light bulb also to turn off this inspection without going to the settings.

Language Version Inspection

If you develop Wolfram packages, you might not have the latest version available or, which is more likely, you try to keep some backward compatibility with former versions of the Wolfram Language. This inspection will help you by flagging functions and constructs that are not yet available in the Wolfram Language version you are developing for.

Below, you see a screenshot of a file that contains an Association and functions that are not available in Mathematica version 9. The inspection will mark them as errors and give you helpful insight in which version the feature was introduced to Mathematica

Language Inspection

There are two ways to select the version you are developing for, and both can be set in the settings page

  • You can use the version of your Mathematica installation that you can set by creating a new or selecting a Mathematica SDK under File | Project Structure | Project | Project SDK. In this case, select checkbox Use Project SDK Language Level as shown in the image below.
  • You can ignore your Project SDK and set a Mathematica version explicitly by unchecking Use Project SDK and by selecting a version.

Missing comma or semicolon

Missing commas can lead to very surprising behavior because Mathematica treats expressions that are separated by whitespace as multiplication. In long expressions that are broken into several lines, this can be a hard to spot an error. Consider the following code

Join[
 {1, 2, 3, 4, 5, 6, 7}
 {1, 2, 3, 4, 5, 6, 7}
 ]

This is completely correct code, but it leads to the result {1, 4, 9, 16, 25, 36, 49} which is not intended here. The reason is that the line break with the missing comma is interpreted as multiplication of the two lists. Now consider that for instance in a Module with a very long list of variables this leads to hard-to-find bugs. IDEA will help you out by annotating such places

Missing comma inspection

The same issue can happen with missing semicolons resulting in unwanted multiplication of expressions. IDEA will warn you about those issues as well. Note that the small indicators on the right side where the scrollbar is point to places where errors and possible bugs were found

Finally, in package code, some users prefer to make a semicolon after each definition others don’t. Some users mix both styles. IDEA has a separate inspection that indicates missing semicolons at file scope that helps you to put semicolons consistently if you prefer that.