Documentation
¶
Overview ¶
Package filetype defines the supported file types and their validators.
KnownFiles are populated at init time from three sources:
- LinguistKnownFiles (generated from GitHub Linguist's languages.yml)
- extraKnownFiles (manual entries not in Linguist, e.g. .shellcheckrc)
- excludeKnownFiles (auto-detected conflicts with dedicated validators)
Filenames in excludeKnownFiles are skipped during population. A conflict is detected when a Linguist filename has an extension that belongs to a file type outside fileTypeRegistry (e.g. .editorconfig → EditorConfig).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var CsvFileType = FileType{ Name: "csv", Extensions: arrToMap("csv"), Validator: validator.CsvValidator{}, }
Instance of the FileType object to represent a CSV file
var EditorConfigFileType = FileType{ Name: "editorconfig", Extensions: arrToMap("editorconfig"), Validator: validator.EditorConfigValidator{}, }
Instance of the FileType object to represent an EDITORCONFIG file
var EnvFileType = FileType{ Name: "env", Extensions: arrToMap("env"), Validator: validator.EnvValidator{}, }
Instance of the FileType object to represent a ENV file
var FileTypes []FileType
FileTypes contains all file types supported by the validator. Populated in init() after KnownFiles are merged from Linguist data.
var HclFileType = FileType{ Name: "hcl", Extensions: arrToMap("hcl", "tf", "tfvars"), Validator: validator.HclValidator{}, }
Instance of the FileType object to represent a HCL file
var HoconFileType = FileType{ Name: "hocon", Extensions: arrToMap("hocon"), Validator: validator.HoconValidator{}, }
Instance of the FileType object to represent a HOCON file
var IniFileType = FileType{ Name: "ini", Extensions: arrToMap("ini"), Validator: validator.IniValidator{}, }
Instance of FileType object to represent a Ini file
var JSONCFileType = FileType{ Name: "jsonc", Extensions: arrToMap("jsonc"), Validator: validator.JSONCValidator{}, }
var JSONFileType = FileType{ Name: "json", Extensions: arrToMap("json"), Validator: validator.JSONValidator{}, }
Instance of the FileType object to represent a JSON file
var JustfileFileType = FileType{ Name: "justfile", Extensions: arrToMap("just"), KnownFiles: map[string]struct{}{ "justfile": {}, "Justfile": {}, ".justfile": {}, }, Validator: validator.JustfileValidator{}, }
var LinguistKnownFiles = map[string][]string{
"ini": {
".buckconfig",
".coveragerc",
".curlrc",
".editorconfig",
".flake8",
".gitconfig",
".gitmodules",
".inputrc",
".nanorc",
".npmrc",
".pylintrc",
".wgetrc",
"HOSTS",
"_curlrc",
"buildozer.spec",
"hosts",
"inputrc",
"nanorc",
"pylintrc",
"ssh-config",
"ssh_config",
"sshconfig",
"sshconfig.snip",
"sshd-config",
"sshd_config",
"suite.rc",
"vlcrc",
},
"json": {
".all-contributorsrc",
".arcconfig",
".auto-changelog",
".c8rc",
".htmlhintrc",
".imgbotconfig",
".nycrc",
".tern-config",
".tern-project",
".watchmanconfig",
"MODULE.bazel.lock",
"Notebook",
"Package.resolved",
"Pipfile.lock",
"bun.lock",
"composer.lock",
"deno.lock",
"flake.lock",
"mcmod.info",
},
"jsonc": {
".babelrc",
".devcontainer.json",
".eslintrc.json",
".jscsrc",
".jshintrc",
".jslintrc",
".oxlintrc.json",
".swcrc",
"api-extractor.json",
"devcontainer.json",
"jsconfig.json",
"language-configuration.json",
"tsconfig.json",
"tslint.json",
},
"toml": {
"Cargo.lock",
"Cargo.toml.orig",
"Gopkg.lock",
"Pipfile",
"mise.local.lock",
"mise.lock",
"pdm.lock",
"poetry.lock",
"uv.lock",
},
"xml": {
".classpath",
".cproject",
".project",
"App.config",
"NuGet.config",
"Settings.StyleCop",
"Web.Debug.config",
"Web.Release.config",
"Web.config",
"ant.xml",
"build.xml",
"packages.config",
"pom.xml",
},
"yaml": {
".clang-format",
".clang-tidy",
".clangd",
".gemrc",
"CITATION.cff",
"MANIFEST.MF",
"glide.lock",
"pixi.lock",
"yarn.lock",
},
}
LinguistKnownFiles maps file type names to known filenames sourced from GitHub Linguist's languages.yml.
var PlistFileType = FileType{ Name: "plist", Extensions: arrToMap("plist"), Validator: validator.PlistValidator{}, }
Instance of the FileType object to represent a Plist file
var PropFileType = FileType{ Name: "properties", Extensions: arrToMap("properties"), Validator: validator.PropValidator{}, }
Instance of FileType object to represent a Properties file
var SarifFileType = FileType{ Name: "sarif", Extensions: arrToMap("sarif"), Validator: validator.SarifValidator{}, }
Instance of the FileType object to represent a Sarif file
var TomlFileType = FileType{ Name: "toml", Extensions: arrToMap("toml"), Validator: validator.TomlValidator{}, }
Instance of FileType object to represent a Toml file
var ToonFileType = FileType{ Name: "toon", Extensions: arrToMap("toon"), Validator: validator.ToonValidator{}, }
Instance of the FileType object to represent a TOON file
var XMLFileType = FileType{ Name: "xml", Extensions: arrToMap("xml"), Validator: validator.XMLValidator{}, }
Instance of FileType object to represent a XML file
var YAMLFileType = FileType{ Name: "yaml", Extensions: arrToMap("yml", "yaml"), Validator: validator.YAMLValidator{}, }
Instance of the FileType object to represent a YAML file
Functions ¶
This section is empty.
Types ¶
type FileType ¶
type FileType struct {
Name string
Extensions map[string]struct{}
KnownFiles map[string]struct{}
Validator validator.Validator
}
The FileType object stores information about a file type including name, extensions, as well as an instance of the file type's validator to be able to validate the file