Hooking into Inspections

Hello everyone,

I'm wondering how I can build on current inspections.  I'd like to take a current inspection, and as soon as it is activated, I'd like to modify the response.  

For example, I'd like to take the warning when a method is too long, and add more information and include some links to articles/content that explain it in more depth and perhaps suggest several possible approaches to correcting the problem.


Thank you - Amr


We don't have any API for this purpose.


Thanks Dmitri,

So if I want to do such a thing, how would you recommend doing it?  Should I go to the intelliJ Community edition code and modify the inspections themselves?  Would I have to create my own custom inspections from scratch?  Etc....

- thanks again for the quick response.


Forking IntelliJ IDEA Community Edition and modifying the inspections is probably the easiest thing you can do.


THat doesn't sound very maintainable.  Is there a technique to add this functionality on and honor the open-closed principle?  Perhaps:

a) Somehow doing this within a plugin?

b) Making inspections 'hookable' and submitting the change to JetBrains for incorporation into the framework?

c) ....  <your advice here />


If you make a pull request that makes exceptions hookable without impacting the performance of inspections, we'd be happy to review it. Also, if the changes you make to the inspections are generally applicable and make the results more useful for everyone, we can simply take your changes as a pull request.


Please sign in to leave a comment.