S013

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2023 License: MPL-2.0 Imports: 5 Imported by: 2

README

S013

The S013 analyzer reports cases of schemas which one of Computed, Optional, or Required is not configured, which will fail provider schema validation.

Flagged Code

map[string]*schema.Schema{
    "attribute_name": {
        Type: schema.TypeString,
    },
}

Passing Code

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

# OR

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

# OR

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

Ignoring Reports

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

//lintignore:S013
map[string]*schema.Schema{
    "attribute_name": {
        Type: schema.TypeString,
    },
}

Documentation

Overview

Package S013 defines an Analyzer that checks for Schema that one of Computed, Optional, or Required is not configured

Index

Constants

View Source
const Doc = `` /* 201-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		schemamapcompositelit.Analyzer,
		commentignore.Analyzer,
	},
	Run: run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL