MCPcopy Create free account
hub / github.com/vale-cli/vale / GetLanguageFromExt

Function GetLanguageFromExt

internal/lint/code/lang.go:25–58  ·  view source on GitHub ↗

GetLanguageFromExt returns a Language based on the given file extension.

(ext string)

Source from the content-addressed store, hash-verified

23
24// GetLanguageFromExt returns a Language based on the given file extension.
25func GetLanguageFromExt(ext string) (*Language, error) {
26 switch core.GetNormedExt(ext) {
27 case ".go":
28 return Go(), nil
29 case ".rs":
30 return Rust(), nil
31 case ".py":
32 return Python(), nil
33 case ".rb":
34 return Ruby(), nil
35 case ".cpp":
36 return Cpp(), nil
37 case ".c":
38 return C(), nil
39 case ".js", ".jsx":
40 return JavaScript(), nil
41 case ".jl":
42 return Julia(), nil
43 case ".java":
44 return Java(), nil
45 case ".ts":
46 return TypeScript(), nil
47 case ".tsx":
48 return Tsx(), nil
49 case ".proto":
50 return Protobuf(), nil
51 case ".yml":
52 return YAML(), nil
53 case ".css":
54 return CSS(), nil
55 default:
56 return nil, fmt.Errorf("unsupported extension: '%s'", ext)
57 }
58}

Callers 3

lintCodeMethod · 0.92
lintFragmentsMethod · 0.92
TestCommentsFunction · 0.85

Calls 15

GetNormedExtFunction · 0.92
GoFunction · 0.85
RustFunction · 0.85
PythonFunction · 0.85
RubyFunction · 0.85
CppFunction · 0.85
CFunction · 0.85
JavaScriptFunction · 0.85
JuliaFunction · 0.85
JavaFunction · 0.85
TypeScriptFunction · 0.85
TsxFunction · 0.85

Tested by 1

TestCommentsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…