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"]),
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    ]),
170    ("log", &["*.log"]),
171    ("lua", &["*.lua"]),
172    ("lz4", &["*.lz4"]),
173    ("lzma", &["*.lzma"]),
174    ("m4", &["*.ac", "*.m4"]),
175    ("make", &[
176        "[Gg][Nn][Uu]makefile", "[Mm]akefile",
177        "[Gg][Nn][Uu]makefile.am", "[Mm]akefile.am",
178        "[Gg][Nn][Uu]makefile.in", "[Mm]akefile.in",
179        "*.mk", "*.mak"
180    ]),
181    ("mako", &["*.mako", "*.mao"]),
182    ("man", &["*.[0-9lnpx]", "*.[0-9][cEFMmpSx]"]),
183    ("matlab", &["*.m"]),
184    ("md", &[
185        "*.markdown",
186        "*.md",
187        "*.mdown",
188        "*.mdwn",
189        "*.mkd",
190        "*.mkdn",
191        "*.mdx",
192    ]),
193    ("meson", &["meson.build", "meson_options.txt", "meson.options"]),
194    ("minified", &["*.min.html", "*.min.css", "*.min.js"]),
195    ("mint", &["*.mint"]),
196    ("mk", &["mkfile"]),
197    ("ml", &["*.ml"]),
198    ("motoko", &["*.mo"]),
199    ("msbuild", &[
200        "*.csproj", "*.fsproj", "*.vcxproj", "*.proj", "*.props", "*.targets",
201        "*.sln",
202    ]),
203    ("nim", &["*.nim", "*.nimf", "*.nimble", "*.nims"]),
204    ("nix", &["*.nix"]),
205    ("objc", &["*.h", "*.m"]),
206    ("objcpp", &["*.h", "*.mm"]),
207    ("ocaml", &["*.ml", "*.mli", "*.mll", "*.mly"]),
208    ("org", &["*.org", "*.org_archive"]),
209    ("pascal", &["*.pas", "*.dpr", "*.lpr", "*.pp", "*.inc"]),
210    ("pdf", &["*.pdf"]),
211    ("perl", &["*.perl", "*.pl", "*.PL", "*.plh", "*.plx", "*.pm", "*.t"]),
212    ("php", &[
213        // note that PHP 6 doesn't exist
214        // See: https://wiki.php.net/rfc/php6
215        "*.php", "*.php3", "*.php4", "*.php5", "*.php7", "*.php8",
216        "*.pht", "*.phtml"
217    ]),
218    ("po", &["*.po"]),
219    ("pod", &["*.pod"]),
220    ("postscript", &["*.eps", "*.ps"]),
221    ("prolog", &["*.prolog", "*.P"]),
222    ("protobuf", &["*.proto"]),
223    ("ps", &["*.cdxml", "*.ps1", "*.ps1xml", "*.psd1", "*.psm1"]),
224    ("puppet", &["*.epp", "*.erb", "*.pp", "*.rb"]),
225    ("purs", &["*.purs"]),
226    ("py", &[
227        "*.py",
228        "*.pyi",
229        // From a spell-check perspective, this is more like Python than toml
230        "pyproject.toml",
231    ]),
232    ("qmake", &["*.pro", "*.pri", "*.prf"]),
233    ("qml", &["*.qml"]),
234    ("r", &["*.R", "*.r", "*.Rmd", "*.Rnw"]),
235    ("racket", &["*.rkt"]),
236    ("raku", &[
237        "*.raku", "*.rakumod", "*.rakudoc", "*.rakutest",
238        "*.p6", "*.pl6", "*.pm6"
239    ]),
240    ("rdoc", &["*.rdoc"]),
241    ("readme", &["README*", "*README"]),
242    ("reasonml", &["*.re", "*.rei"]),
243    ("red", &["*.r", "*.red", "*.reds"]),
244    ("rescript", &["*.res", "*.resi"]),
245    ("robot", &["*.robot"]),
246    ("rst", &["*.rst"]),
247    ("ruby", &[
248        // Idiomatic files
249        "config.ru", "Gemfile", ".irbrc", "Rakefile",
250        // Extensions
251        "*.gemspec", "*.rb", "*.rbw"
252    ]),
253    ("rust", &[
254        "*.rs",
255        // From a spell-check perspective, this is more like Python than toml
256        "Cargo.toml",
257    ]),
258    ("sass", &["*.sass", "*.scss"]),
259    ("scala", &["*.scala", "*.sbt"]),
260    ("sh", &[
261        // Portable/misc. init files
262        ".login", ".logout", ".profile", "profile",
263        // bash-specific init files
264        ".bash_login", "bash_login",
265        ".bash_logout", "bash_logout",
266        ".bash_profile", "bash_profile",
267        ".bashrc", "bashrc", "*.bashrc",
268        // csh-specific init files
269        ".cshrc", "*.cshrc",
270        // ksh-specific init files
271        ".kshrc", "*.kshrc",
272        // tcsh-specific init files
273        ".tcshrc",
274        // zsh-specific init files
275        ".zshenv", "zshenv",
276        ".zlogin", "zlogin",
277        ".zlogout", "zlogout",
278        ".zprofile", "zprofile",
279        ".zshrc", "zshrc",
280        // Extensions
281        "*.bash", "*.csh", "*.ksh", "*.sh", "*.tcsh", "*.zsh",
282    ]),
283    ("slim", &["*.skim", "*.slim", "*.slime"]),
284    ("smarty", &["*.tpl"]),
285    ("sml", &["*.sml", "*.sig"]),
286    ("solidity", &["*.sol"]),
287    ("soy", &["*.soy"]),
288    ("spark", &["*.spark"]),
289    ("spec", &["*.spec"]),
290    ("sql", &["*.sql", "*.psql"]),
291    ("stylus", &["*.styl"]),
292    ("sv", &["*.v", "*.vg", "*.sv", "*.svh", "*.h"]),
293    ("svelte", &["*.svelte"]),
294    ("svg", &["*.svg"]),
295    ("swift", &["*.swift"]),
296    ("swig", &["*.def", "*.i"]),
297    ("systemd", &[
298        "*.automount", "*.conf", "*.device", "*.link", "*.mount", "*.path",
299        "*.scope", "*.service", "*.slice", "*.socket", "*.swap", "*.target",
300        "*.timer",
301    ]),
302    ("taskpaper", &["*.taskpaper"]),
303    ("tcl", &["*.tcl"]),
304    ("tex", &["*.tex", "*.ltx", "*.cls", "*.sty", "*.bib", "*.dtx", "*.ins"]),
305    ("texinfo", &["*.texi"]),
306    ("textile", &["*.textile"]),
307    ("tf", &[
308        "*.tf", "*.auto.tfvars", "terraform.tfvars", "*.tf.json",
309        "*.auto.tfvars.json", "terraform.tfvars.json", "*.terraformrc",
310        "terraform.rc", "*.tfrc",
311    ]),
312    ("thrift", &["*.thrift"]),
313    ("toml", &["*.toml"]),
314    ("ts", &["*.ts", "*.tsx", "*.cts", "*.mts"]),
315    ("twig", &["*.twig"]),
316    ("txt", &["*.txt"]),
317    ("typoscript", &["*.typoscript"]),
318    ("usd", &["*.usd", "*.usda", "*.usdc"]),
319    ("v", &["*.v", "*.vsh"]),
320    ("vala", &["*.vala"]),
321    ("vb", &["*.vb"]),
322    ("vcl", &["*.vcl"]),
323    ("verilog", &["*.v", "*.vh", "*.sv", "*.svh"]),
324    ("vhdl", &["*.vhd", "*.vhdl"]),
325    ("vimscript", &[
326        "*.vim", ".vimrc", ".gvimrc", "vimrc", "gvimrc", "_vimrc", "_gvimrc",
327    ]),
328    ("webidl", &["*.idl", "*.webidl", "*.widl"]),
329    ("wgsl", &["*.wgsl"]),
330    ("wiki", &["*.mediawiki", "*.wiki"]),
331    ("xml", &[
332        "*.xml", "*.xml.dist", "*.dtd", "*.xsl", "*.xslt", "*.xsd", "*.xjb",
333        "*.rng", "*.sch", "*.xhtml",
334    ]),
335    ("xz", &["*.xz", "*.txz"]),
336    ("yacc", &["*.y"]),
337    ("yaml", &["*.yaml", "*.yml"]),
338    ("yang", &["*.yang"]),
339    ("z", &["*.Z"]),
340    ("zig", &["*.zig"]),
341    ("zsh", &[
342        ".zshenv", "zshenv",
343        ".zlogin", "zlogin",
344        ".zlogout", "zlogout",
345        ".zprofile", "zprofile",
346        ".zshrc", "zshrc",
347        "*.zsh",
348    ]),
349    ("zstd", &["*.zst", "*.zstd"]),
350];
351
352// See `cargo test --lib -- --nocapture default_types::check_duplicates`
353#[test]
354fn check_duplicates() {
355    let mut reverse = std::collections::BTreeMap::new();
356    for (name, exts) in DEFAULT_TYPES {
357        for ext in *exts {
358            reverse.entry(ext).or_insert(Vec::new()).push(name);
359        }
360    }
361
362    for (ext, names) in reverse {
363        if 1 < names.len() {
364            println!("{ext} is under multiple names: {names:?}");
365        }
366    }
367}