Home > Software design >  Disable warning about Capitalized function names
Disable warning about Capitalized function names

Time:12-27

I am working on building a DSL using Kotlin for a specific part of our application (in its own module). But, IntelliJ keeps complaining about capitalized function naming...This is how I would like to keep the naming of DSL functions. Any way to disable/supress this at module level?

Example: enter image description here

CodePudding user response:

This is just an IntelliJ inspection, which you can disable in the IntelliJ settings.

Go to Editor -> Inspections -> Kotlin -> Naming conventions and find "function naming convention", as shown here:

enter image description here

Notice that on the right, you can edit the warning/error level by scope. If you click on the dropdown, then select "Edit Scopes Order", you get a dialog box like this where you can add the folder containing the code for your DSL as a new scope using the pencil icon:

enter image description here

You can also add a scope by going into the Scopes tab in the settings.

Finally, you can set the inspection to be "no highlighting, only fix" in your newly created scope.

Learn more about scopes here.

CodePudding user response:

I don't know if it's possible at module level, but you can put

@Suppress("FunctionName")

above the method or class to suppress it at method or class level. or put

@file:Suppress("FunctionName")

at the top of a file to suppress it at file level

  • Related