Skip to content

Commit

Permalink
WRONG_OVERLOADING_FUNCTION_ARGUMENTS: adding exceptions to the rule
Browse files Browse the repository at this point in the history
### What's done:
- rule will be triggered if and only if it has same modifiers
  • Loading branch information
orchestr7 committed Sep 14, 2022
1 parent 7fe9d8f commit 43324e9
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ class OverloadingArgumentsFunction(configRules: List<RulesConfig>) : DiktatRule(
/**
* We can raise errors only on those methods that have same modifiers (inline/public/etc.)
*/
private fun KtFunction.hasSameModifiers(other: KtFunction): Boolean = this.modifierList?.node?.getChildren(KtTokens.MODIFIER_KEYWORDS)
?.sortedBy { it.text } ==
other.modifierList?.node?.getChildren(KtTokens.MODIFIER_KEYWORDS)
?.sortedBy { it.text }
private fun KtFunction.hasSameModifiers(other: KtFunction) =
this.modifierList?.node?.getChildren(KtTokens.MODIFIER_KEYWORDS)
?.map { it.text }
?.sortedBy { it } ==
other.modifierList?.node?.getChildren(KtTokens.MODIFIER_KEYWORDS)
?.map { it.text }
?.sortedBy { it }

/**
* we need to compare following things for two functions:
Expand Down

0 comments on commit 43324e9

Please sign in to comment.