nbadal / ktlint-intellij-plugin

Ktlint plugin for IntelliJ IDEA + Android Studio
MIT License
159 stars 24 forks source link

Function names enclosed in backticks are throwing a "function naming" exception #493

Closed takanuva15 closed 6 months ago

takanuva15 commented 6 months ago

I have a few Kotlin test classes in this repo which contain function names enclosed in backticks. According to the ktlint documentation, function names enclosed in backticks should be excluded from the standard:function-naming ruleset:

function names enclosed between backticks do not need to adhere to the normal naming convention

However, with the latest plugin version, when I open a file with backticked function-names, it's throwing an error saying I need to fix it:

image

Is this a plugin error? Or an issue with ktlint itself?

paul-dingemans commented 6 months ago

Not a plugin, and not a ktlint error. The full quote is:

Functions in files which import a class from package io.kotest, junit.framework, kotlin.test, org.junit, or org.testng are considered to be test functions. Functions in such classes are allowed to have underscores in the name. Also, function names enclosed between backticks do not need to adhere to the normal naming convention.

Your example class does not contain an import from one of the packages io.kotest, junit.framework, kotlin.test, org.junit, or org.testng. So this class can not be recognized as being a test class.