Files
android_development/tools/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule
Romain Guy 1e2cbdfa84 New rules for layoutopt: IncorrectHeight/WidthIn[Horizontal]ScrollView, UselessView.
This change also refactors the uix library to remove an unnecessary class (LayoutNode.)
The refactoring helps writing cleaner script by accessing only the node object instead
of xml and node. This change also augment the capabilities of the node in Groovy scripts.

Change-Id: Id7515f9a79826909834d82496a6d9dfbc19988ad
2009-10-06 11:42:02 -07:00

12 lines
348 B
Plaintext

// Rule: TooManyLevels
//
// Description: Checks whether the layout has too many nested groups.
//
// Conditions:
// - The depth of the layout is > 10
if (node.isRoot() && (depth = node.depth()) > 10) {
analysis << [node: null, description: "This layout has too many nested layouts: " +
"${depth} levels, it should have <= 10!"]
}