Skip to content

Commit

Permalink
Fix the UnnecessaryPassThroughClass rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Feb 14, 2024
1 parent d9d5641 commit dbff4a9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class UnnecessaryPassThroughClassRule(config: Config) : Rule(config) {
klass.isData()
) return

// TODO: Ignore if the class has any "val/var" in the body
// Check if the class body contains any 'val' or 'var' properties
val hasProperties = klass.body?.properties?.isNotEmpty() ?: false
if (hasProperties) return // Ignore the class if it contains properties

val functions = klass.body?.functions?.takeIf { it.isNotEmpty() } ?: return
val passThroughClass = functions.all(::isPassThroughFunction)
Expand Down

0 comments on commit dbff4a9

Please sign in to comment.