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