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