Map a file extension to a human-readable language name.
(ext: &str)
| 117 | |
| 118 | /// Map a file extension to a human-readable language name. |
| 119 | pub fn detect_language(ext: &str) -> &'static str { |
| 120 | match ext { |
| 121 | "rs" => "Rust", |
| 122 | "ts" | "mts" | "cts" => "TypeScript", |
| 123 | "tsx" => "TSX", |
| 124 | "js" | "mjs" | "cjs" => "JavaScript", |
| 125 | "jsx" => "JSX", |
| 126 | "py" => "Python", |
| 127 | "go" => "Go", |
| 128 | "java" => "Java", |
| 129 | "c" => "C", |
| 130 | "cpp" | "cc" | "cxx" => "C++", |
| 131 | "h" => "C Header", |
| 132 | "hpp" | "hxx" => "C++ Header", |
| 133 | "rb" => "Ruby", |
| 134 | "swift" => "Swift", |
| 135 | "kt" | "kts" => "Kotlin", |
| 136 | "scala" => "Scala", |
| 137 | "cs" => "C#", |
| 138 | "php" => "PHP", |
| 139 | "lua" => "Lua", |
| 140 | "r" | "R" => "R", |
| 141 | "sh" | "bash" | "zsh" => "Shell", |
| 142 | "sql" => "SQL", |
| 143 | "html" | "htm" => "HTML", |
| 144 | "css" => "CSS", |
| 145 | "scss" | "sass" => "SCSS", |
| 146 | "json" => "JSON", |
| 147 | "yaml" | "yml" => "YAML", |
| 148 | "toml" => "TOML", |
| 149 | "xml" => "XML", |
| 150 | "md" | "markdown" => "Markdown", |
| 151 | "zig" => "Zig", |
| 152 | "nim" => "Nim", |
| 153 | "ex" | "exs" => "Elixir", |
| 154 | "erl" | "hrl" => "Erlang", |
| 155 | "hs" => "Haskell", |
| 156 | "ml" | "mli" => "OCaml", |
| 157 | "clj" | "cljs" => "Clojure", |
| 158 | "dart" => "Dart", |
| 159 | "vue" => "Vue", |
| 160 | "svelte" => "Svelte", |
| 161 | "tf" | "hcl" => "Terraform", |
| 162 | "proto" => "Protobuf", |
| 163 | "graphql" | "gql" => "GraphQL", |
| 164 | "dockerfile" => "Dockerfile", |
| 165 | "makefile" => "Makefile", |
| 166 | _ => "Other", |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | /// Directories that should be skipped when walking source trees. |
| 171 | pub fn should_skip_dir(name: &str) -> bool { |
no outgoing calls
no test coverage detected