Documentation ¶
Index ¶
- Constants
- Variables
- func FileExtensionCheck(path string, validExtensions []string) error
- func FilePathEndsWithExtensionFrom(path string, validExtensions []string) bool
- func FileSizeCheck(fullpath string) error
- func InvalidDirectoriesCheck(dirPath string) error
- func IsValidCdktfDirectory(directory string) bool
- func IsValidLegacyDirectory(directory string) bool
- func IsValidRegistryDirectory(directory string) bool
- func MixedDirectoriesCheck(docFiles []string) error
- func NumberOfFilesCheck(docFiles []string) error
- func TrimFileExtension(path string) string
- type FileMismatchCheck
- func (check *FileMismatchCheck) FunctionFileMismatchCheck(files []os.DirEntry, functions map[string]*tfjson.FunctionSignature) error
- func (check *FileMismatchCheck) IgnoreFileMismatch(file string) bool
- func (check *FileMismatchCheck) IgnoreFileMissing(resourceName string) bool
- func (check *FileMismatchCheck) ResourceFileMismatchCheck(files []os.DirEntry, resourceType string, schemas map[string]*tfjson.Schema) error
- func (check *FileMismatchCheck) Run() error
- type FileMismatchOptions
- type FileOptions
- type FrontMatterCheck
- type FrontMatterData
- type FrontMatterOptions
- type ProviderFileCheck
- type ProviderFileOptions
Constants ¶
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 )
const ( FileExtensionHtmlMarkdown = `.html.markdown` FileExtensionHtmlMd = `.html.md` FileExtensionMarkdown = `.markdown` FileExtensionMd = `.md` )
Variables ¶
var ValidCdktfLanguages = []string{
"csharp",
"go",
"java",
"python",
"typescript",
}
var ValidLegacyDirectories = []string{ LegacyIndexDirectory, LegacyIndexDirectory + "/" + LegacyDataSourcesDirectory, LegacyIndexDirectory + "/" + LegacyGuidesDirectory, LegacyIndexDirectory + "/" + LegacyResourcesDirectory, LegacyIndexDirectory + "/" + LegacyFunctionsDirectory, }
var ValidLegacyFileExtensions = []string{ FileExtensionHtmlMarkdown, FileExtensionHtmlMd, FileExtensionMarkdown, FileExtensionMd, }
var ValidLegacySubdirectories = []string{ LegacyIndexDirectory, LegacyDataSourcesDirectory, LegacyGuidesDirectory, LegacyResourcesDirectory, }
var ValidRegistryDirectories = []string{ RegistryIndexDirectory, RegistryIndexDirectory + "/" + RegistryDataSourcesDirectory, RegistryIndexDirectory + "/" + RegistryGuidesDirectory, RegistryIndexDirectory + "/" + RegistryResourcesDirectory, RegistryIndexDirectory + "/" + RegistryFunctionsDirectory, }
var ValidRegistryFileExtensions = []string{ FileExtensionMd, }
var ValidRegistrySubdirectories = []string{ RegistryIndexDirectory, RegistryDataSourcesDirectory, RegistryGuidesDirectory, RegistryResourcesDirectory, }
Functions ¶
func FileExtensionCheck ¶
FileExtensionCheck checks if the file extension of the given path is valid.
func FileSizeCheck ¶
FileSizeCheck verifies that documentation file is below the Terraform Registry storage limit.
func InvalidDirectoriesCheck ¶
func IsValidCdktfDirectory ¶
func IsValidLegacyDirectory ¶
func MixedDirectoriesCheck ¶
func NumberOfFilesCheck ¶
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 ¶
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 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 }