blob: 134dbd5c794595f81e2bc6d44c69a5f75c114b1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// Rule: TooManyChildren
//
// Description: Checks whether the layout has too many children.
//
// Conditions:
// - The layout is a ScrollView and has more than 1 child
// - The layout is a list or grid ans has at least 1 child
if (xml.name() in ["ScrollView", "HorizontalScrollView"] && xml.'*'.size() > 1) {
analysis << [node: node, description: "A scroll view can have only one child"]
}
if (xml.name() in ["ListView", "GridView"] && xml.'*'.size() > 0) {
analysis << [node: node, description: "A list/grid should have no children declared in XML"]
}
|