Help us shape the future of Go! Take the 2026 Go Developer Survey

check

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package check verifies the structure and contents of Terraform Provider documentation directories and files.

Deprecated: tfproviderdocs is no longer maintained. All functionality has been superseded by github.com/YakDriver/swissshepherd. Please migrate: https://github.com/YakDriver/swissshepherd

Index

Constants

View Source
const (
	ResourceTypeAction       = "action"
	ResourceTypeDataSource   = "data source"
	ResourceTypeEphemeral    = "ephemeral"
	ResourceTypeFunction     = "function"
	ResourceTypeListResource = "list resource"
	ResourceTypeResource     = "resource"

	// Terraform Registry Storage Limits
	RegistryMaximumSizeOfFile = 500000 // 500KB
)
View Source
const (
	CdktfIndexDirectory = `cdktf`

	DocumentationGlobPattern = `` /* 132-byte string literal not displayed */

	LegacyIndexDirectory         = `website/docs`
	LegacyActionsDirectory       = `actions`
	LegacyDataSourcesDirectory   = `d`
	LegacyEphemeralsDirectory    = `ephemeral-resources`
	LegacyFunctionsDirectory     = `functions`
	LegacyGuidesDirectory        = `guides`
	LegacyListResourcesDirectory = `list-resources`
	LegacyResourcesDirectory     = `r`

	RegistryIndexDirectory         = `docs`
	RegistryActionsDirectory       = `actions`
	RegistryDataSourcesDirectory   = `data-sources`
	RegistryEphemeralsDirectory    = `ephemeral-resources`
	RegistryFunctionsDirectory     = `functions`
	RegistryGuidesDirectory        = `guides`
	RegistryListResourcesDirectory = `list-resources`
	RegistryResourcesDirectory     = `resources`
)
View Source
const (
	FileExtensionHtmlMarkdown = `.html.markdown`
	FileExtensionHtmlMd       = `.html.md`
	FileExtensionMarkdown     = `.markdown`
	FileExtensionMd           = `.md`
)
View Source
const (
	FileIgnoreDSStore = `.DS_Store`
)

Variables

View Source
var IgnoreFiles = []string{
	FileIgnoreDSStore,
}
View Source
var ValidCdktfLanguages = []string{
	"csharp",
	"go",
	"java",
	"python",
	"typescript",
}
View Source
var ValidRegistryFileExtensions = []string{
	FileExtensionMd,
}

Functions

func FileIgnoreCheck added in v0.16.7

func FileIgnoreCheck(path string) bool

FileIgnoreCheck checks if the file should be ignored.

func FilePathEndsWithExtensionFrom

func FilePathEndsWithExtensionFrom(path string, validExtensions []string) bool

func FileSizeCheck

func FileSizeCheck(fullpath string) error

FileSizeCheck verifies that documentation file is below the Terraform Registry storage limit.

func GetDirectories

func GetDirectories(basepath string) (map[string][]string, error)

func InvalidDirectoriesCheck

func InvalidDirectoriesCheck(directories map[string][]string) error

func IsValidCdktfDirectory

func IsValidCdktfDirectory(directory string) bool

func IsValidLegacyDirectory

func IsValidLegacyDirectory(directory string) bool

func IsValidRegistryDirectory

func IsValidRegistryDirectory(directory string) bool

func LegacyFileExtensionCheck

func LegacyFileExtensionCheck(path string) error

func MixedDirectoriesCheck

func MixedDirectoriesCheck(directories map[string][]string) error

func RegistryFileExtensionCheck

func RegistryFileExtensionCheck(path string) error

func TrimFileExtension

func TrimFileExtension(path string) string

TrimFileExtension removes file extensions including those with multiple periods.

Types

type Check

type Check struct {
	Options *CheckOptions
}

func NewCheck

func NewCheck(opts *CheckOptions) *Check

func (*Check) Run

func (check *Check) Run(directories map[string][]string) error

type CheckOptions

type CheckOptions struct {
	ActionFileMismatch       *FileMismatchOptions
	DataSourceFileMismatch   *FileMismatchOptions
	EphemeralFileMismatch    *FileMismatchOptions
	FunctionFileMismatch     *FileMismatchOptions
	ListResourceFileMismatch *FileMismatchOptions
	ResourceFileMismatch     *FileMismatchOptions

	LegacyActionFile       *LegacyActionFileOptions
	LegacyDataSourceFile   *LegacyDataSourceFileOptions
	LegacyEphemeralFile    *LegacyEphemeralFileOptions
	LegacyFunctionFile     *LegacyFunctionFileOptions
	LegacyGuideFile        *LegacyGuideFileOptions
	LegacyIndexFile        *LegacyIndexFileOptions
	LegacyListResourceFile *LegacyListResourceFileOptions
	LegacyResourceFile     *LegacyResourceFileOptions

	ProviderName   string
	ProviderSource string

	RegistryActionFile       *RegistryActionFileOptions
	RegistryDataSourceFile   *RegistryDataSourceFileOptions
	RegistryEphemeralFile    *RegistryEphemeralFileOptions
	RegistryFunctionFile     *RegistryFunctionFileOptions
	RegistryGuideFile        *RegistryGuideFileOptions
	RegistryIndexFile        *RegistryIndexFileOptions
	RegistryListResourceFile *RegistryListResourceFileOptions
	RegistryResourceFile     *RegistryResourceFileOptions

	IgnoreCdktfMissingFiles bool
}

type ContentsCheck

type ContentsCheck struct {
	Options *ContentsOptions
}

func NewContentsCheck

func NewContentsCheck(opts *ContentsOptions) *ContentsCheck

func (*ContentsCheck) Run

func (check *ContentsCheck) Run(path string, exampleLanguage string, subcategory *string) error

type ContentsOptions

type ContentsOptions struct {
	*FileOptions

	Enable                                 bool
	EnhancedRegionChecks                   bool
	ProviderName                           string
	RequireAttributesSection               contents.SectionRequirement
	RequireTimeoutsSection                 contents.SectionRequirement
	RequireImportSection                   contents.SectionRequirement
	RequireSchemaOrdering                  bool
	IgnoreContentsCheck                    []string
	IgnoreEnhancedRegionCheck              []string
	IgnoreEnhancedRegionCheckSubcategories []string
	TitleSectionPrefixes                   []string
	RequireSignatureSection                contents.SectionRequirement
	SignatureHeadingTexts                  []string
	SignatureRequiresCodeBlock             bool
	ArgumentsHeadingTexts                  []string
	AllowArgumentsMissingByline            bool

	DisableRegionArgumentCheck         bool
	DisallowAttributesSection          bool
	AttributesSectionDisallowedMessage string
	DisallowImportSection              bool
	ImportSectionDisallowedMessage     string
	ArgumentsBylineTexts               []string
}

ContentsOptions represents configuration options for Contents.

type FileCheck

type FileCheck interface {
	Run(string) error
	RunAll([]string) error
}

type FileMismatchCheck

type FileMismatchCheck struct {
	Options *FileMismatchOptions
}

func NewFileMismatchCheck

func NewFileMismatchCheck(opts *FileMismatchOptions) *FileMismatchCheck

func (*FileMismatchCheck) IgnoreFileMismatch

func (check *FileMismatchCheck) IgnoreFileMismatch(file string) bool

func (*FileMismatchCheck) IgnoreFileMissing

func (check *FileMismatchCheck) IgnoreFileMissing(resourceName string) bool

func (*FileMismatchCheck) Run

func (check *FileMismatchCheck) Run(files []string) error

type FileMismatchOptions

type FileMismatchOptions struct {
	*FileOptions

	IgnoreFileMismatch []string

	IgnoreFileMissing []string

	ProviderName string

	ResourceType string

	ResourceNames []string
}

type FileOptions

type FileOptions struct {
	BasePath string
}

func (*FileOptions) FullPath

func (opts *FileOptions) FullPath(path string) string

FullPath returns the full path of the file, combining path portions from opts.BasePath and path.

type FrontMatterCheck

type FrontMatterCheck struct {
	Options *FrontMatterOptions
}

func NewFrontMatterCheck

func NewFrontMatterCheck(opts *FrontMatterOptions) *FrontMatterCheck

func (*FrontMatterCheck) Run

func (check *FrontMatterCheck) Run(src []byte) (*string, error)

type FrontMatterData

type FrontMatterData struct {
	Description    *string `yaml:"description,omitempty"`
	Layout         *string `yaml:"layout,omitempty"`
	PageTitle      *string `yaml:"page_title,omitempty"`
	SidebarCurrent *string `yaml:"sidebar_current,omitempty"`
	Subcategory    *string `yaml:"subcategory,omitempty"`
}

FrontMatterData represents the YAML frontmatter of Terraform Provider documentation.

type FrontMatterOptions

type FrontMatterOptions struct {
	AllowedSubcategories []string
	NoDescription        bool
	NoLayout             bool
	NoPageTitle          bool
	NoSidebarCurrent     bool
	NoSubcategory        bool
	RequireDescription   bool
	RequireLayout        bool
	RequirePageTitle     bool
	RequireSubcategory   bool
}

FrontMatterOptions represents configuration options for FrontMatter.

type LegacyActionFileCheck added in v0.23.0

type LegacyActionFileCheck struct {
	FileCheck

	Options *LegacyActionFileOptions
}

func NewLegacyActionFileCheck added in v0.23.0

func NewLegacyActionFileCheck(opts *LegacyActionFileOptions) *LegacyActionFileCheck

func (*LegacyActionFileCheck) Run added in v0.23.0

func (check *LegacyActionFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyActionFileCheck) RunAll added in v0.23.0

func (check *LegacyActionFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyActionFileOptions added in v0.23.0

type LegacyActionFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type LegacyDataSourceFileCheck

type LegacyDataSourceFileCheck struct {
	FileCheck

	Options *LegacyDataSourceFileOptions
}

func (*LegacyDataSourceFileCheck) Run

func (check *LegacyDataSourceFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyDataSourceFileCheck) RunAll

func (check *LegacyDataSourceFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyDataSourceFileOptions

type LegacyDataSourceFileOptions struct {
	*FileOptions

	Contents    *ContentsOptions
	FrontMatter *FrontMatterOptions
}

type LegacyEphemeralFileCheck added in v0.16.0

type LegacyEphemeralFileCheck struct {
	FileCheck

	Options *LegacyEphemeralFileOptions
}

func NewLegacyEphemeralFileCheck added in v0.16.0

func NewLegacyEphemeralFileCheck(opts *LegacyEphemeralFileOptions) *LegacyEphemeralFileCheck

func (*LegacyEphemeralFileCheck) Run added in v0.16.0

func (check *LegacyEphemeralFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyEphemeralFileCheck) RunAll added in v0.16.0

func (check *LegacyEphemeralFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyEphemeralFileOptions added in v0.16.0

type LegacyEphemeralFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type LegacyFunctionFileCheck added in v0.12.0

type LegacyFunctionFileCheck struct {
	FileCheck

	Options *LegacyFunctionFileOptions
}

func NewLegacyFunctionFileCheck added in v0.12.0

func NewLegacyFunctionFileCheck(opts *LegacyFunctionFileOptions) *LegacyFunctionFileCheck

func (*LegacyFunctionFileCheck) Run added in v0.12.0

func (check *LegacyFunctionFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyFunctionFileCheck) RunAll added in v0.12.0

func (check *LegacyFunctionFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyFunctionFileOptions added in v0.12.0

type LegacyFunctionFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type LegacyGuideFileCheck

type LegacyGuideFileCheck struct {
	FileCheck

	Options *LegacyGuideFileOptions
}

func NewLegacyGuideFileCheck

func NewLegacyGuideFileCheck(opts *LegacyGuideFileOptions) *LegacyGuideFileCheck

func (*LegacyGuideFileCheck) Run

func (check *LegacyGuideFileCheck) Run(path string) error

func (*LegacyGuideFileCheck) RunAll

func (check *LegacyGuideFileCheck) RunAll(files []string) error

type LegacyGuideFileOptions

type LegacyGuideFileOptions struct {
	*FileOptions

	FrontMatter *FrontMatterOptions
}

type LegacyIndexFileCheck

type LegacyIndexFileCheck struct {
	FileCheck

	Options *LegacyIndexFileOptions
}

func NewLegacyIndexFileCheck

func NewLegacyIndexFileCheck(opts *LegacyIndexFileOptions) *LegacyIndexFileCheck

func (*LegacyIndexFileCheck) Run

func (check *LegacyIndexFileCheck) Run(path string) error

func (*LegacyIndexFileCheck) RunAll

func (check *LegacyIndexFileCheck) RunAll(files []string) error

type LegacyIndexFileOptions

type LegacyIndexFileOptions struct {
	*FileOptions

	FrontMatter *FrontMatterOptions
}

type LegacyListResourceFileCheck added in v0.23.0

type LegacyListResourceFileCheck struct {
	FileCheck

	Options *LegacyListResourceFileOptions
}

func NewLegacyListResourceFileCheck added in v0.23.0

func NewLegacyListResourceFileCheck(opts *LegacyListResourceFileOptions) *LegacyListResourceFileCheck

func (*LegacyListResourceFileCheck) Run added in v0.23.0

func (check *LegacyListResourceFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyListResourceFileCheck) RunAll added in v0.23.0

func (check *LegacyListResourceFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyListResourceFileOptions added in v0.23.0

type LegacyListResourceFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type LegacyResourceFileCheck

type LegacyResourceFileCheck struct {
	FileCheck

	Options *LegacyResourceFileOptions
}

func (*LegacyResourceFileCheck) Run

func (check *LegacyResourceFileCheck) Run(path string, exampleLanguage string) error

func (*LegacyResourceFileCheck) RunAll

func (check *LegacyResourceFileCheck) RunAll(files []string, exampleLanguage string) error

type LegacyResourceFileOptions

type LegacyResourceFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type RegistryActionFileCheck added in v0.23.0

type RegistryActionFileCheck struct {
	FileCheck

	Options *RegistryActionFileOptions
}

func NewRegistryActionFileCheck added in v0.23.0

func NewRegistryActionFileCheck(opts *RegistryActionFileOptions) *RegistryActionFileCheck

func (*RegistryActionFileCheck) Run added in v0.23.0

func (check *RegistryActionFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryActionFileCheck) RunAll added in v0.23.0

func (check *RegistryActionFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryActionFileOptions added in v0.23.0

type RegistryActionFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type RegistryDataSourceFileCheck

type RegistryDataSourceFileCheck struct {
	FileCheck

	Options *RegistryDataSourceFileOptions
}

func (*RegistryDataSourceFileCheck) Run

func (check *RegistryDataSourceFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryDataSourceFileCheck) RunAll

func (check *RegistryDataSourceFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryDataSourceFileOptions

type RegistryDataSourceFileOptions struct {
	*FileOptions

	Contents    *ContentsOptions
	FrontMatter *FrontMatterOptions
}

type RegistryEphemeralFileCheck added in v0.16.0

type RegistryEphemeralFileCheck struct {
	FileCheck

	Options *RegistryEphemeralFileOptions
}

func NewRegistryEphemeralFileCheck added in v0.16.0

func NewRegistryEphemeralFileCheck(opts *RegistryEphemeralFileOptions) *RegistryEphemeralFileCheck

func (*RegistryEphemeralFileCheck) Run added in v0.16.0

func (check *RegistryEphemeralFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryEphemeralFileCheck) RunAll added in v0.16.0

func (check *RegistryEphemeralFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryEphemeralFileOptions added in v0.16.0

type RegistryEphemeralFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type RegistryFunctionFileCheck added in v0.12.0

type RegistryFunctionFileCheck struct {
	FileCheck

	Options *RegistryFunctionFileOptions
}

func NewRegistryFunctionFileCheck added in v0.12.0

func NewRegistryFunctionFileCheck(opts *RegistryFunctionFileOptions) *RegistryFunctionFileCheck

func (*RegistryFunctionFileCheck) Run added in v0.12.0

func (check *RegistryFunctionFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryFunctionFileCheck) RunAll added in v0.12.0

func (check *RegistryFunctionFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryFunctionFileOptions added in v0.12.0

type RegistryFunctionFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type RegistryGuideFileCheck

type RegistryGuideFileCheck struct {
	FileCheck

	Options *RegistryGuideFileOptions
}

func NewRegistryGuideFileCheck

func NewRegistryGuideFileCheck(opts *RegistryGuideFileOptions) *RegistryGuideFileCheck

func (*RegistryGuideFileCheck) Run

func (check *RegistryGuideFileCheck) Run(path string) error

func (*RegistryGuideFileCheck) RunAll

func (check *RegistryGuideFileCheck) RunAll(files []string) error

type RegistryGuideFileOptions

type RegistryGuideFileOptions struct {
	*FileOptions

	FrontMatter *FrontMatterOptions
}

type RegistryIndexFileCheck

type RegistryIndexFileCheck struct {
	FileCheck

	Options *RegistryIndexFileOptions
}

func NewRegistryIndexFileCheck

func NewRegistryIndexFileCheck(opts *RegistryIndexFileOptions) *RegistryIndexFileCheck

func (*RegistryIndexFileCheck) Run

func (check *RegistryIndexFileCheck) Run(path string) error

func (*RegistryIndexFileCheck) RunAll

func (check *RegistryIndexFileCheck) RunAll(files []string) error

type RegistryIndexFileOptions

type RegistryIndexFileOptions struct {
	*FileOptions

	FrontMatter *FrontMatterOptions
}

type RegistryListResourceFileCheck added in v0.23.0

type RegistryListResourceFileCheck struct {
	FileCheck

	Options *RegistryListResourceFileOptions
}

func NewRegistryListResourceFileCheck added in v0.23.0

func NewRegistryListResourceFileCheck(opts *RegistryListResourceFileOptions) *RegistryListResourceFileCheck

func (*RegistryListResourceFileCheck) Run added in v0.23.0

func (check *RegistryListResourceFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryListResourceFileCheck) RunAll added in v0.23.0

func (check *RegistryListResourceFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryListResourceFileOptions added in v0.23.0

type RegistryListResourceFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

type RegistryResourceFileCheck

type RegistryResourceFileCheck struct {
	FileCheck

	Options *RegistryResourceFileOptions
}

func (*RegistryResourceFileCheck) Run

func (check *RegistryResourceFileCheck) Run(path string, exampleLanguage string) error

func (*RegistryResourceFileCheck) RunAll

func (check *RegistryResourceFileCheck) RunAll(files []string, exampleLanguage string) error

type RegistryResourceFileOptions

type RegistryResourceFileOptions struct {
	*FileOptions

	Contents     *ContentsOptions
	FrontMatter  *FrontMatterOptions
	ProviderName string
}

Directories

Path Synopsis
Package contents validates the body of individual Terraform Provider documentation files: headings, sections, schema attribute lists, and related content rules.
Package contents validates the body of individual Terraform Provider documentation files: headings, sections, schema attribute lists, and related content rules.

Jump to

Keyboard shortcuts

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