def main()

in tools/tflint-fast.py [0:0]


def main(junit):
  ret = 0
  for tftest_path in sorted(
      glob.glob(f'{BASEDIR}/tests/fast/**/tftest.yaml', recursive=True)):
    with open(tftest_path, 'r') as f:
      tftest = yaml.safe_load(f)
    module_path = Path(tftest['module'])
    var_path = (Path(tftest_path).parent / 'simple.tfvars')

    print(f'## {Path(tftest_path).relative_to(BASEDIR)}')
    if var_path.exists():
      args = ['tflint']
      if junit:
        args += ['--format=junit']
      args += [
          '--chdir',
          str((BASEDIR / module_path).absolute()),
          '--var-file',
          str((BASEDIR / var_path).absolute()),
          '--config',
          str((BASEDIR / ".tflint.hcl").absolute()),
      ]
      print(' '.join(args))
      if junit:
        with open(f'tflint-fast-{str(module_path).replace("/", "_")}.xml',
                  'w+') as output:
          ret |= subprocess.run(args, stderr=subprocess.STDOUT,
                                stdout=output).returncode
      else:
        ret |= subprocess.run(args, stderr=subprocess.STDOUT).returncode
    else:
      print(f'Skipping stage: {tftest_path} as no simple.tfvars found there')
  # end for
  exit(ret)