parameters: (root_path)
return_statement: return rules
docstring: Collects and returns all rules from root path recursively.
docstring_summary: Collects and returns all rules from root path recursively.
docstring_tokens: Collects and returns all rules from root path recursively .
function: def collect_rules(root_path):
    """Collects and returns all rules from root path recursively."""
    rules = []
    for cur, _, _ in os.walk(root_path):
      build_path = os.path.join(cur, "BUILD.bazel")
      if os.path.exists(build_path):
        rules.extend(read_build("//" + cur))
    return rules
function_tokens: def collect_rules ( root_path ) : rules = [ ] for cur , _ , _ in os . walk ( root_path ) : build_path = os . path . join ( cur , "BUILD.bazel" ) if os . path . exists ( build_path ) : rules . extend ( read_build ( "//" + cur ) ) return rules