S015

SchemasStandard

check for map[string]*Schema that attribute names are valid

The S015 analyzer reports cases of schemas which the attribute name includes characters outside lowercase alphanumerics and underscores, which will fail provider schema validation.

Examples

map[string]*schema.Schema{
    "INVALID": {
        Required: true,
        Type:     schema.TypeString,
    },
}

map[string]*schema.Schema{
    "invalid!": {
        Required: true,
        Type:     schema.TypeString,
    },
}

map[string]*schema.Schema{
    "invalid-name": {
        Required: true,
        Type:     schema.TypeString,
    },
}
map[string]*schema.Schema{
    "valid": {
        Required: true,
        Type:     schema.TypeString,
    },
}

map[string]*schema.Schema{
    "valid_name": {
        Required: true,
        Type:     schema.TypeString,
    },
}

Ignoring reports

Singular reports can be ignored by adding a //lintignore:S015 Go code comment at the end of the offending line or on the line immediately preceding, e.g.

//lintignore:S015
map[string]*schema.Schema{
    "INVALID": {
        Required: true,
        Type:     schema.TypeString,
    },
}

This page is generated from passes/S015/README.md, which lives beside the analyzer.