check

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CdktfIndexDirectory = `cdktf`

	LegacyIndexDirectory       = `website/docs`
	LegacyDataSourcesDirectory = `d`
	LegacyGuidesDirectory      = `guides`
	LegacyResourcesDirectory   = `r`
	LegacyFunctionsDirectory   = `functions`

	RegistryIndexDirectory       = `docs`
	RegistryDataSourcesDirectory = `data-sources`
	RegistryGuidesDirectory      = `guides`
	RegistryResourcesDirectory   = `resources`
	RegistryFunctionsDirectory   = `functions`

	// Terraform Registry Storage Limits
	// https://www.terraform.io/docs/registry/providers/docs.html#storage-limits
	RegistryMaximumNumberOfFiles = 2000
	RegistryMaximumSizeOfFile    = 500000 // 500KB

)
View Source
const (
	FileExtensionHtmlMarkdown = `.html.markdown`
	FileExtensionHtmlMd       = `.html.md`
	FileExtensionMarkdown     = `.markdown`
	FileExtensionMd           = `.md`
)

Variables

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

Functions

func FileExtensionCheck

func FileExtensionCheck(path string, validExtensions []string) error

FileExtensionCheck checks if the file extension of the given path is valid.

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 InvalidDirectoriesCheck

func InvalidDirectoriesCheck(dirPath string) error

func IsValidCdktfDirectory

func IsValidCdktfDirectory(directory string) bool

func IsValidLegacyDirectory

func IsValidLegacyDirectory(directory string) bool

func IsValidRegistryDirectory

func IsValidRegistryDirectory(directory string) bool

func MixedDirectoriesCheck

func MixedDirectoriesCheck(docFiles []string) error

func NumberOfFilesCheck

func NumberOfFilesCheck(docFiles []string) error

NumberOfFilesCheck verifies that documentation is below the Terraform Registry storage limit. This check presumes that all provided directories are valid, e.g. that directory checking for invalid or mixed directory structures was previously completed.

func TrimFileExtension

func TrimFileExtension(path string) string

TrimFileExtension removes file extensions including those with multiple periods.

Types

type FileMismatchCheck

type FileMismatchCheck struct {
	Options *FileMismatchOptions
}

func NewFileMismatchCheck

func NewFileMismatchCheck(opts *FileMismatchOptions) *FileMismatchCheck

func (*FileMismatchCheck) FunctionFileMismatchCheck

func (check *FileMismatchCheck) FunctionFileMismatchCheck(files []os.DirEntry, functions map[string]*tfjson.FunctionSignature) error

FunctionFileMismatchCheck checks for mismatched files, either missing or extraneous, against the function signature

func (*FileMismatchCheck) IgnoreFileMismatch

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

func (*FileMismatchCheck) IgnoreFileMissing

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

func (*FileMismatchCheck) ResourceFileMismatchCheck

func (check *FileMismatchCheck) ResourceFileMismatchCheck(files []os.DirEntry, resourceType string, schemas map[string]*tfjson.Schema) error

ResourceFileMismatchCheck checks for mismatched files, either missing or extraneous, against the resource/datasouce schema

func (*FileMismatchCheck) Run

func (check *FileMismatchCheck) Run() error

type FileMismatchOptions

type FileMismatchOptions struct {
	*FileOptions

	IgnoreFileMismatch []string

	IgnoreFileMissing []string

	ProviderShortName string

	DatasourceEntries []os.DirEntry

	ResourceEntries []os.DirEntry

	FunctionEntries []os.DirEntry

	Schema *tfjson.ProviderSchema
}

type FileOptions

type FileOptions struct {
	BasePath string
}

func (*FileOptions) FullPath

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

type FrontMatterCheck

type FrontMatterCheck struct {
	Options *FrontMatterOptions
}

func NewFrontMatterCheck

func NewFrontMatterCheck(opts *FrontMatterOptions) *FrontMatterCheck

func (*FrontMatterCheck) Run

func (check *FrontMatterCheck) Run(src []byte) 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 {
	NoLayout           bool
	NoPageTitle        bool
	NoSidebarCurrent   bool
	NoSubcategory      bool
	RequireDescription bool
	RequireLayout      bool
	RequirePageTitle   bool
}

FrontMatterOptions represents configuration options for FrontMatter.

type ProviderFileCheck

type ProviderFileCheck struct {
	Options *ProviderFileOptions
}

func NewProviderFileCheck

func NewProviderFileCheck(opts *ProviderFileOptions) *ProviderFileCheck

func (*ProviderFileCheck) Run

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

type ProviderFileOptions

type ProviderFileOptions struct {
	*FileOptions

	FrontMatter     *FrontMatterOptions
	ValidExtensions []string
}

Jump to

Keyboard shortcuts

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