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.

Thoughts/advice?

Thank you - Amr

5 comments

We don't have any API for this purpose.

0

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.

0

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

0

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 />

0

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.

0

Please sign in to leave a comment.