How to create my custom inspection for variable naming rule?

215 views Asked by At

I want to create naming convention rule for member variable in inspection profile of IntelliJ. for example: if developer gives member variable name as "test" then it should complain using my custom inspection and suggests the naming should be "m_test".

How do I achieve it in IntelliJ? I checked in existing inspection profile and couldn't able to find any rule regarding this.

1

There are 1 answers

1
yole On BEST ANSWER

There is a built-in inspection for this; you don't need to write a new one. The inspection is under Java | Naming conventions | Instance field naming convention. You can specify the regular expression for the name in the "Pattern" field.