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