Javier
02/24/2024, 2:43 PMdetekt - ReturnCount: Function generateProperties has 3 return statements which exceeds the limit of 2.
?
I would like to avoid nesting and doing multiple returns is easy, readable and avoid nesting, for example:
override fun generateProperties(
callableId: CallableId,
context: MemberGenerationContext?
): List<FirPropertySymbol> {
if (callableId.callableName != atomicName) return emptyList()
val owner: FirClassSymbol<*> = context?.owner ?: return emptyList()
...
}
Harold Martin
02/24/2024, 3:47 PMJavier
02/24/2024, 3:49 PMgenerateProperties
function from the visitor does anything based on those statements, how can I do that with less code and/or being more readable?eygraber
02/25/2024, 2:43 AMgenerateProperties
function) shouldn't count towards the return count for that rule. Although now that I think about it, that might not be the default behavior and you have to configure it.eygraber
02/25/2024, 2:44 AMexcludeGuardClauses
Javier
02/25/2024, 9:45 AM