January 27, 2006

IntelliJ IDEA 6.0 "Demetra": Per-project and per-scope inspection profiles

This feature is in fact something I promised to blog about quite a long time ago, but after the initial implementation was nearly complete, we decided that we don’t really like the way it turned out, and ended up redoing the feature completely. This post describes the second, reworked implementation – and who knows what changes we will need to do with it based on feedback from users?..

In previous versions of IntelliJ IDEA, the inspection profile was a user’s personal setting; it was possible to export and import inspection profiles, but having a single inspection profile shared between all developers working on the project was quite cumbersome. There was no simple way to propagate the inspection profile changes to all users if the profile was changed after initial configuration. Also, the only way to have different inspection settings in different files of the project was to disable inspections on per-file basis using an icon in the status bar. (In fact, the name for the icon – “Hector the Inspector” – was initially suggested by one of our EAP members, but we liked it so much that we started using it even in the names of classes related to implementing its functionality.)

IntelliJ IDEA 6.0 makes this much more flexible: it is now possible to store inspection profiles in the project file, and the custom scopes mechanism can be used to associate different inspection profiles with different parts of the project.


As you can see, we have a separate inspection profile for test sources (where the error strictness is much less important), another for the OpenAPI (where JavaDoc errors are highlighted), and yet another for runtime classes which need to be compatible with JDK 1.3 (so all Java 5 features and API methods are forbidden). The scope definition language is very flexible: for example, the OpenAPI profile is defined as “all modules which have openapi as part of the name”.


We have also made a number of extensions to the scope definition language. For example, it can now apply to files of any type and not only to Java classes, and it supports module groups (so you can define a scope as “all modules in this module group”).

When a new inspection profile is created, you can choose whether it should be saved as your personal profile (IDE profile), or as a shared profile in the .ipr file.


The status bar now shows the profile which is used to inspect the file currently open in the editor, and provides a quick way to access the profile settings. Note that we have dropped the old possibility to disable inspections on per-file basis: the scopes functionality is much more powerful, and if single-file suppressions are indeed what you need, you can create single-file scopes and associate empty inspection profiles with them.


Posted by Dmitry Jemerov at January 27, 2006 06:59 PM

nice feature!

Posted by: dmitry skavish at January 27, 2006 10:15 PM

Excellent. Simply excellent.

Posted by: Dave Griffith at January 29, 2006 04:03 PM

I can't wait to get my hands on this.

Posted by: Bas Leijdekkers at January 29, 2006 11:09 PM

Wow, this is gonna be great. One thing I've been wondering about is whether it would make sense to be able to define JAR-based scopes: Especially for seeing the difference between OpenAPI vs. non-OpenAPI (idea.jar) stuff this would be great - openapi.jar contains a lot more than *.openapi.* classes. However I'm not sure if it would be that useful for anything else.

Posted by: Sascha Weinreuter at February 3, 2006 12:52 AM

This seems like a very nice feature. Is it possible to create your own custom rules for a profile?

Posted by: Rafael Gonzalez at February 17, 2006 06:00 PM

Is there a way (in 5.x or the upcoming 6.0) to enable inspections only on code that I have changed? I don't want to go through all the existing code and fix it up to get rid of warnings, but do want to make sure that any code I add (or change significantly) works correctly.

Also, another severity level would be nice (like "info"). Some inspections (like "infinite recursion") are almost errors while others are useful but don't require your immediate attention. I don't want to flag the severe ones as errors because they aren't necessarily errors.

Posted by: Steve at May 19, 2006 09:08 PM

What's the point in code inspection for only a small portion of the code? If the code is buggy it should be fixed anyway. If the class is too big and too dificult to understand it should be rewritten (or better: redesigned).

Posted by: Pieter at May 20, 2006 09:43 PM

Is there a way to disable/change Highlighting level for HTML syntax for all files. To change it on each and every jsp by turning that man in the corner it a pain. I have more than 800 jsps in my project.

Posted by: Ritesh at March 16, 2007 09:41 AM
Post a comment

Remember personal info?