typos_cli/
default_types.rs

1/// This list represents the default file types that ripgrep ships with. In
2/// general, any file format is fair game, although it should generally be
3/// limited to reasonably popular open formats. For other cases, you can add
4/// types to each invocation of ripgrep with the '--type-add' flag.
5///
6/// If you would like to add or improve this list, please file a PR:
7/// <https://github.com/BurntSushi/ripgrep>.
8///
9/// Please try to keep this list sorted lexicographically and wrapped to 79
10/// columns (inclusive).
11#[rustfmt::skip]
12pub(crate) const DEFAULT_TYPES: &[(&str, &[&str])] = &[
13    ("ada", &["*.adb", "*.ads"]),
14    ("agda", &["*.agda", "*.lagda"]),
15    ("aidl", &["*.aidl"]),
16    ("alire", &["alire.toml"]),
17    ("amake", &["*.mk", "*.bp"]),
18    ("asciidoc", &["*.adoc", "*.asc", "*.asciidoc"]),
19    ("asm", &["*.asm", "*.s", "*.S"]),
20    ("asp", &[
21        "*.aspx", "*.aspx.cs", "*.aspx.vb", "*.ascx", "*.ascx.cs",
22        "*.ascx.vb", "*.asp"
23    ]),
24    ("ats", &["*.ats", "*.dats", "*.sats", "*.hats"]),
25    ("avro", &["*.avdl", "*.avpr", "*.avsc"]),
26    ("awk", &["*.awk"]),
27    ("bat", &["*.bat", "*.cmd"]),
28    ("bazel", &[
29        "*.bazel", "*.bzl", "*.BUILD", "*.bazelrc", "BUILD", "MODULE.bazel",
30        "WORKSPACE", "WORKSPACE.bazel",
31    ]),
32    ("bitbake", &["*.bb", "*.bbappend", "*.bbclass", "*.conf", "*.inc"]),
33    ("brotli", &["*.br"]),
34    ("buildstream", &["*.bst"]),
35    ("bzip2", &["*.bz2", "*.tbz2"]),
36    ("c", &["*.[chH]", "*.[chH].in", "*.cats"]),
37    ("cabal", &["*.cabal"]),
38    ("candid", &["*.did"]),
39    ("carp", &["*.carp"]),
40    ("cbor", &["*.cbor"]),
41    ("cert", &[
42        // Certificate files:
43        "*.crt",
44        "*.cer",
45        "*.ca-bundle",
46        "*.p7b",
47        "*.p7c",
48        "*.p7s",
49        // Keystore Files:
50        "*.key",
51        "*.keystore",
52        "*.jks",
53        // Combined certificate and key files:
54        "*.p12",
55        "*.pfx",
56        "*.pem",
57    ]),
58    ("ceylon", &["*.ceylon"]),
59    ("clojure", &["*.clj", "*.cljc", "*.cljs", "*.cljx"]),
60    ("cmake", &["*.cmake", "CMakeLists.txt"]),
61    ("cml", &["*.cml"]),
62    ("coffeescript", &["*.coffee"]),
63    ("config", &["*.cfg", "*.conf", "*.config", "*.ini"]),
64    ("coq", &["*.v"]),
65    ("cpp", &[
66        "*.[ChH]", "*.cc", "*.[ch]pp", "*.[ch]xx", "*.hh",  "*.inl",
67        "*.[ChH].in", "*.cc.in", "*.[ch]pp.in", "*.[ch]xx.in", "*.hh.in",
68    ]),
69    ("creole", &["*.creole"]),
70    ("crystal", &["Projectfile", "*.cr", "*.ecr", "shard.yml"]),
71    ("csharp", &["*.cs"]),
72    ("cshtml", &["*.cshtml"]),
73    ("css", &["*.css", "*.scss"]),
74    ("csv", &["*.csv"]),
75    ("cuda", &["*.cu", "*.cuh"]),
76    ("cython", &["*.pyx", "*.pxi", "*.pxd"]),
77    ("d", &["*.d"]),
78    ("dart", &["*.dart"]),
79    ("devicetree", &["*.dts", "*.dtsi", "*.dtso"]),
80    ("dhall", &["*.dhall"]),
81    ("diff", &["*.patch", "*.diff"]),
82    ("dita", &["*.dita", "*.ditamap", "*.ditaval"]),
83    ("docker", &["*Dockerfile*"]),
84    ("dockercompose", &["docker-compose.yml", "docker-compose.*.yml"]),
85    ("dvc", &["Dvcfile", "*.dvc"]),
86    ("ebuild", &["*.ebuild", "*.eclass"]),
87    ("edn", &["*.edn"]),
88    ("elisp", &["*.el"]),
89    ("elixir", &["*.ex", "*.eex", "*.exs", "*.heex", "*.leex", "*.livemd"]),
90    ("elm", &["*.elm"]),
91    ("erb", &["*.erb"]),
92    ("erlang", &["*.erl", "*.hrl"]),
93    ("fennel", &["*.fnl"]),
94    ("fidl", &["*.fidl"]),
95    ("fish", &["*.fish"]),
96    ("flatbuffers", &["*.fbs"]),
97    ("fortran", &[
98        "*.f", "*.F", "*.f77", "*.F77", "*.pfo",
99        "*.f90", "*.F90", "*.f95", "*.F95",
100    ]),
101    ("fsharp", &["*.fs", "*.fsx", "*.fsi"]),
102    ("fut", &["*.fut"]),
103    ("gap", &["*.g", "*.gap", "*.gi", "*.gd", "*.tst"]),
104    ("gn", &["*.gn", "*.gni"]),
105    ("go", &["*.go", "go.work"]),
106    ("gprbuild", &["*.gpr"]),
107    ("gradle", &[
108        "*.gradle", "*.gradle.kts", "gradle.properties", "gradle-wrapper.*",
109        "gradlew", "gradlew.bat",
110    ]),
111    ("graphql", &["*.graphql", "*.graphqls"]),
112    ("groovy", &["*.groovy", "*.gradle"]),
113    ("gzip", &["*.gz", "*.tgz"]),
114    ("h", &["*.h", "*.hpp"]),
115    ("haml", &["*.haml"]),
116    ("hare", &["*.ha"]),
117    ("hbs", &["*.hbs"]),
118    ("hs", &["*.hs", "*.lhs", "*.cpphs", "*.c2hs", "*.hsc"]),
119    ("html", &["*.htm", "*.html", "*.ejs"]),
120    ("hy", &["*.hy"]),
121    ("idris", &["*.idr", "*.lidr"]),
122    ("janet", &["*.janet"]),
123    ("java", &["*.java", "*.jsp", "*.jspx", "*.properties"]),
124    ("jinja", &["*.j2", "*.jinja", "*.jinja2"]),
125    ("jl", &["*.jl"]),
126    ("js", &["*.js", "*.jsx", "*.vue", "*.cjs", "*.mjs"]),
127    ("json", &["*.json"]),
128    ("jsonl", &["*.jsonl"]),
129    ("jupyter", &["*.ipynb", "*.jpynb"]),
130    ("k", &["*.k"]),
131    ("kotlin", &["*.kt", "*.kts"]),
132    ("lean", &["*.lean"]),
133    ("less", &["*.less"]),
134    ("license", &[
135        // General
136        "COPYING", "COPYING[.-]*",
137        "COPYRIGHT", "COPYRIGHT[.-]*",
138        "EULA", "EULA[.-]*",
139        "licen[cs]e", "licen[cs]e.*",
140        "LICEN[CS]E", "LICEN[CS]E[.-]*", "*[.-]LICEN[CS]E*",
141        "NOTICE", "NOTICE[.-]*",
142        "PATENTS", "PATENTS[.-]*",
143        "UNLICEN[CS]E", "UNLICEN[CS]E[.-]*",
144        // GPL (gpl.txt, etc.)
145        "agpl[.-]*",
146        "gpl[.-]*",
147        "lgpl[.-]*",
148        // Other license-specific (APACHE-2.0.txt, etc.)
149        "AGPL-*[0-9]*",
150        "APACHE-*[0-9]*",
151        "BSD-*[0-9]*",
152        "CC-BY-*",
153        "GFDL-*[0-9]*",
154        "GNU-*[0-9]*",
155        "GPL-*[0-9]*",
156        "LGPL-*[0-9]*",
157        "MIT-*[0-9]*",
158        "MPL-*[0-9]*",
159        "OFL-*[0-9]*",
160    ]),
161    ("lilypond", &["*.ly", "*.ily"]),
162    ("lisp", &["*.el", "*.lisp", "*.lsp", "*.sc", "*.scm"]),
163    ("lock", &[
164        "*.lock",
165        "package-lock.json", "pnpm-lock.yaml",
166        "composer.lock", "*.terraform.lock.hcl",
167        "requirements.txt",
168        "go.sum",
169        "go.work.sum",
170    ]),
171    ("log", &["*.log"]),
172    ("lua", &["*.lua"]),
173    ("lz4", &["*.lz4"]),
174    ("lzma", &["*.lzma"]),
175    ("m4", &["*.ac", "*.m4"]),
176    ("make", &[
177        "[Gg][Nn][Uu]makefile", "[Mm]akefile",
178        "[Gg][Nn][Uu]makefile.am", "[Mm]akefile.am",
179        "[Gg][Nn][Uu]makefile.in", "[Mm]akefile.in",
180        "*.mk", "*.mak"
181    ]),
182    ("mako", &["*.mako", "*.mao"]),
183    ("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
184    ("matlab", &["*.m"]),
185    ("md", &[
186        "*.markdown",
187        "*.md",
188        "*.mdown",
189        "*.mdwn",
190        "*.mkd",
191        "*.mkdn",
192        "*.mdx",
193    ]),
194    ("meson", &["meson.build", "meson_options.txt", "meson.options"]),
195    ("minified", &["*.min.html", "*.min.css", "*.min.js"]),
196    ("mint", &["*.mint"]),
197    ("mk", &["mkfile"]),
198    ("ml", &["*.ml"]),
199    ("motoko", &["*.mo"]),
200    ("msbuild", &[
201        "*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
202        "*.sln",
203    ]),
204    ("nim", &["*.nim", "*.nimf", "*.nimble", "*.nims"]),
205    ("nix", &["*.nix"]),
206    ("objc", &["*.h", "*.m"]),
207    ("objcpp", &["*.h", "*.mm"]),
208    ("ocaml", &["*.ml", "*.mli", "*.mll", "*.mly"]),
209    ("org", &["*.org", "*.org_archive"]),
210    ("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
211    ("pdf", &["*.pdf"]),
212    ("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
213    ("php", &[
214        // note that PHP 6 doesn't exist
215        // See: https://wiki.php.net/rfc/php6
216        "*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
217        "*.pht", "*.phtml"
218    ]),
219    ("po", &["*.po"]),
220    ("pod", &["*.pod"]),
221    ("postscript", &["*.eps", "*.ps"]),
222    ("prolog", &["*.prolog", "*.P"]),
223    ("protobuf", &["*.proto"]),
224    ("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
225    ("puppet", &["*.epp", "*.erb", "*.pp", "*.rb"]),
226    ("purs", &["*.purs"]),
227    ("py", &[
228        "*.py",
229        "*.pyi",
230        // From a spell-check perspective, this is more like Python than toml
231        "pyproject.toml",
232    ]),
233    ("qmake", &["*.pro", "*.pri", "*.prf"]),
234    ("qml", &["*.qml"]),
235    ("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
236    ("racket", &["*.rkt"]),
237    ("raku", &[
238        "*.raku", "*.rakumod", "*.rakudoc", "*.rakutest",
239        "*.p6", "*.pl6", "*.pm6"
240    ]),
241    ("rdoc", &["*.rdoc"]),
242    ("readme", &["README*", "*README"]),
243    ("reasonml", &["*.re", "*.rei"]),
244    ("red", &["*.r", "*.red", "*.reds"]),
245    ("rescript", &["*.res", "*.resi"]),
246    ("robot", &["*.robot"]),
247    ("rst", &["*.rst"]),
248    ("ruby", &[
249        // Idiomatic files
250        "config.ru", "Gemfile", ".irbrc", "Rakefile",
251        // Extensions
252        "*.gemspec", "*.rb", "*.rbw"
253    ]),
254    ("rust", &[
255        "*.rs",
256        // From a spell-check perspective, this is more like Python than toml
257        "Cargo.toml",
258    ]),
259    ("sass", &["*.sass", "*.scss"]),
260    ("scala", &["*.scala", "*.sbt"]),
261    ("sh", &[
262        // Portable/misc. init files
263        ".login", ".logout", ".profile", "profile",
264        // bash-specific init files
265        ".bash_login", "bash_login",
266        ".bash_logout", "bash_logout",
267        ".bash_profile", "bash_profile",
268        ".bashrc", "bashrc", "*.bashrc",
269        // csh-specific init files
270        ".cshrc", "*.cshrc",
271        // ksh-specific init files
272        ".kshrc", "*.kshrc",
273        // tcsh-specific init files
274        ".tcshrc",
275        // zsh-specific init files
276        ".zshenv", "zshenv",
277        ".zlogin", "zlogin",
278        ".zlogout", "zlogout",
279        ".zprofile", "zprofile",
280        ".zshrc", "zshrc",
281        // Extensions
282        "*.bash", "*.csh", "*.ksh", "*.sh", "*.tcsh", "*.zsh",
283    ]),
284    ("slim", &["*.skim", "*.slim", "*.slime"]),
285    ("smarty", &["*.tpl"]),
286    ("sml", &["*.sml", "*.sig"]),
287    ("solidity", &["*.sol"]),
288    ("soy", &["*.soy"]),
289    ("spark", &["*.spark"]),
290    ("spec", &["*.spec"]),
291    ("sql", &["*.sql", "*.psql"]),
292    ("stylus", &["*.styl"]),
293    ("sv", &["*.v", "*.vg", "*.sv", "*.svh", "*.h"]),
294    ("svelte", &["*.svelte"]),
295    ("svg", &["*.svg"]),
296    ("swift", &["*.swift"]),
297    ("swig", &["*.def", "*.i"]),
298    ("systemd", &[
299        "*.automount", "*.conf", "*.device", "*.link", "*.mount", "*.path",
300        "*.scope", "*.service", "*.slice", "*.socket", "*.swap", "*.target",
301        "*.timer",
302    ]),
303    ("taskpaper", &["*.taskpaper"]),
304    ("tcl", &["*.tcl"]),
305    ("tex", &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
306    ("texinfo", &["*.texi"]),
307    ("textile", &["*.textile"]),
308    ("tf", &[
309        "*.tf", "*.auto.tfvars", "terraform.tfvars", "*.tf.json",
310        "*.auto.tfvars.json", "terraform.tfvars.json", "*.terraformrc",
311        "terraform.rc", "*.tfrc",
312    ]),
313    ("thrift", &["*.thrift"]),
314    ("toml", &["*.toml"]),
315    ("ts", &["*.ts", "*.tsx", "*.cts", "*.mts"]),
316    ("twig", &["*.twig"]),
317    ("txt", &["*.txt"]),
318    ("typoscript", &["*.typoscript"]),
319    ("usd", &["*.usd", "*.usda", "*.usdc"]),
320    ("v", &["*.v", "*.vsh"]),
321    ("vala", &["*.vala"]),
322    ("vb", &["*.vb"]),
323    ("vcl", &["*.vcl"]),
324    ("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
325    ("vhdl", &["*.vhd", "*.vhdl"]),
326    ("vimscript", &[
327        "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
328    ]),
329    ("webidl", &["*.idl", "*.webidl", "*.widl"]),
330    ("wgsl", &["*.wgsl"]),
331    ("wiki", &["*.mediawiki", "*.wiki"]),
332    ("xml", &[
333        "*.xml", "*.xml.dist", "*.dtd", "*.xsl", "*.xslt", "*.xsd", "*.xjb",
334        "*.rng", "*.sch", "*.xhtml",
335    ]),
336    ("xz", &["*.xz", "*.txz"]),
337    ("yacc", &["*.y"]),
338    ("yaml", &["*.yaml", "*.yml"]),
339    ("yang", &["*.yang"]),
340    ("z", &["*.Z"]),
341    ("zig", &["*.zig"]),
342    ("zsh", &[
343        ".zshenv", "zshenv",
344        ".zlogin", "zlogin",
345        ".zlogout", "zlogout",
346        ".zprofile", "zprofile",
347        ".zshrc", "zshrc",
348        "*.zsh",
349    ]),
350    ("zstd", &["*.zst", "*.zstd"]),
351];
352
353// See `cargo test --lib -- --nocapture default_types::check_duplicates`
354#[test]
355fn check_duplicates() {
356    let mut reverse = std::collections::BTreeMap::new();
357    for (name, exts) in DEFAULT_TYPES {
358        for ext in *exts {
359            reverse.entry(ext).or_insert(Vec::new()).push(name);
360        }
361    }
362
363    for (ext, names) in reverse {
364        if 1 < names.len() {
365            println!("{ext} is under multiple names: {names:?}");
366        }
367    }
368}