docs: def scan_roles(self):
          """
          Iterate over each role and report its stats.
          """
          for key, value in sorted(self.roles.iteritems()):
              self.paths["role"] = os.path.join(self.roles_path, key)
              self.paths["meta"] = os.path.join(self.paths["role"], "meta",
                                                "main.yml")
              self.paths["readme"] = os.path.join(self.paths["role"],
                                                  "README.{0}"
                                                  .format(self.readme_format))
              self.paths["defaults"] = os.path.join(self.paths["role"],
                                                    "defaults", "main.yml")
  
              self.report["roles"][key] = self.report_role(key)
  
              # we are writing a readme file which means the state of the role
              # needs to be updated before it gets output by the ui
              if self.gendoc:
                  if self.valid_meta(key):
                      self.make_meta_dict_consistent()
                      self.set_readme_template_vars(key, value)
                      self.write_readme(key)
              # only load the meta file when generating meta files
              elif self.genmeta:
                  self.make_or_augment_meta(key)
                  if self.valid_meta(key):
                      self.make_meta_dict_consistent()
                      self.write_meta(key)
              else:
                  self.update_scan_report(key)
  
              if not self.config["options_quiet"] and not self.export:
                  ui.role(key,
                          self.report["roles"][key],
                          self.report["stats"]["longest_role_name_length"])
  
          self.tally_role_columns()
  
          # below this point is only UI output, so we can return
          if self.config["options_quiet"] or self.export:
              return
  
          ui.totals(self.report["totals"],
                    len(self.report["roles"].keys()),
                    self.report["stats"]["longest_role_name_length"])
  
          if self.gendoc:
              ui.gen_totals(self.report["state"], "readme")
          elif self.genmeta:
              ui.gen_totals(self.report["state"], "meta")
          else:
              ui.scan_totals(self.report["state"])