When you inspect your code, you have to tell WebStorm which types of problems you would like to search for and get reports about. Such configuration can be preserved as an inspection profile.
Inspection profile defines the types of problems to be sought for, severity of these problems, and color scheme of alerts. Profiles are configurable in the Inspections dialog box.
Inspection profiles can be stored on the IDE or project level:
- Project profiles are shared and accessible for the team members. They are stored in project.
- IDE profiles are intended for personal use only and are stored locally in XML files under the USER_HOME/.<WebStorm version>/config/inspection directory.
WebStorm comes with the following pre-defined inspection profiles:
- Default: This local (IDE level) profile is intended for personal use only and is stored locally in the file Default.xml under the USER_HOME/.<WebStorm version>/config/inspection directory.
- Project Default: When a new project is created, its Project Default
profile is copied from the settings of a template project. This profile is shared by default.
After that, any modifications to the project default profile will pass unnoticed to any other project.
When the settings of the Project Default profile are modified in the Template Project settings, then the changed profile will apply to all newly created projects, but the existing projects will not be affected.
Project Default profile is stored in the file Project_Default.xml, in the directory <project>/.idea/inspectionProfiles.
One can have as many inspection profiles as required. Whenever a new profile is created, it is in fact a copy of the Default profile (Add), or the currently selected profile (Copy). The newly created profiles are stored in XML files, located depending on the type of the base profile .
The files <profile_name>.xml representing inspection profiles appear whenever some changes to the profiles are done and applied. The files store only differences against the base profile.
Refer to the section Customizing Profiles for details.
A project can be divided into several areas of inspections, or scopes, where different inspections should apply. Associating an inspection profile with a scope is described in the section Defining Scope-Profile Combination.
Examples of Code Inspections
Numerous automated Code Inspections help you easily detect different inconsistencies. In WebStorm you will find that all inspections are grouped by their goals and sense. Every inspection has an appropriate description. The most common tasks that are covered by the static code analysis are:
- Finding probable bugs.
- Locating dead code.
- Detecting performance issues.
- Improving code structure and maintainability.
- Conforming to coding guidelines and standards.
- Conforming to specifications.