1 // Rule: UselessView 2 // 3 // Description: Checks whether a container view can be removed. 4 // 5 // Conditions: 6 // - The node is a container view (LinearLayout, etc.) 7 // - The node has no id 8 // - The node has no background 9 // - The node has no children 10 11 if (node.isContainer() && node.'*'.size() == 0 && !node.'@android:id' && 12 !node.'@android:background') { 13 analysis << "This ${node.name()} view is useless (no children, no background, no id)" 14 } 15