Question about a new custom inspection

Hi there,

in our team, we have several internal rules for "logging". One rule is: every method has a call like

LOG.trace("method xyz entered")

which is the first line within the method, and a line like

LOG.trace("method xyz leaving")

which is the last line.

Now, I'd like to have a new inspection which checks just that: if a method lacks any of these calls, show this within the inspection results.

Unfortunately I do not have any clue how to create this inspection. Any help will be appreciated.

 

0
1 comment

See the inspection sample https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/inspection and the plugin https://github.com/markiewb/idea-find-duplicate-class-inspection-plugin for the scaffolding of a fixable inspection.

You have to define a visitor at Method-level and then the inspection of the first and last statement of the block can begin.

 

0

Please sign in to leave a comment.