Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get inspections or static code analysis errors in intellij Idea from Intellij Idea Plugin programmatically?

I want to create a plugin for intellij idea and in that I want to get the inspections or code analysis errors.By default intellij will show those code inspections like errors, dead code, or unused components.So I want to get those inspections pro grammatically to my plugin.I am able to create an tool button from my plugin and getting the code. Process is,

  1. created plugin for intellij Idea with some actions and tools menu.
  2. running the plugin, created separate instace in intellijIdea
  3. wrote some java code in new instance of intellij in editor

-->in that it will show inspections or errors

so I want get those inspection to my plugin.How can I do that?

like image 440
Hanuman Avatar asked Oct 16 '25 14:10

Hanuman


1 Answers

The simplest API for getting the inspection errors in a given set of files is CodeSmellDetector:

CodeSmellDetector.getInstance(project).findCodeSmells(files);
like image 94
yole Avatar answered Oct 18 '25 09:10

yole