MCPcopy Create free account
hub / github.com/alibaba/open-code-review / languageKey

Function languageKey

internal/scan/batch.go:96–106  ·  view source on GitHub ↗

languageKey returns the lowercased file extension (with the leading dot) or " " for extensionless files.

(it model.ScanItem)

Source from the content-addressed store, hash-verified

94// languageKey returns the lowercased file extension (with the leading dot)
95// or "<no-ext>" for extensionless files.
96func languageKey(it model.ScanItem) string {
97 base := it.Path
98 if i := strings.LastIndex(base, "/"); i >= 0 {
99 base = base[i+1:]
100 }
101 dot := strings.LastIndex(base, ".")
102 if dot <= 0 {
103 return "<no-ext>"
104 }
105 return strings.ToLower(base[dot:])
106}
107
108// firstLevelDirKey returns the first path segment of a repo-relative path,
109// or "<root>" for files directly in the repo root.

Calls

no outgoing calls

Tested by 1