func()

in rules/terraform_required_version_declaration.go [41:63]


func (r *TerraformRequiredVersionDeclarationRule) CheckFile(runner tflint.Runner, file *hcl.File) error {
	var err error
	body, ok := file.Body.(*hclsyntax.Body)
	if !ok {
		logger.Debug("skip terraform_required_version_declaration check since it's not hcl file")
		return nil
	}
	filename := body.Range().Filename
	if isOverrideTfFile(filename) {
		logger.Debug("skip terraform_required_version_declaration check since it's override file")
		return nil
	}
	blocks := body.Blocks
	for _, block := range blocks {
		if block.Type != "terraform" {
			continue
		}
		if subErr := r.checkBlock(runner, block); subErr != nil {
			err = multierror.Append(err, subErr)
		}
	}
	return err
}