Skip to content

Commit

Permalink
ident: add GitLab, DevOps, IssueHunt, LFX brands
Browse files Browse the repository at this point in the history
These help generate nicer identifiers in the githubv4 package.

Also remove mention of golint since it's deprecated, and sort
the initialisms map.
  • Loading branch information
dmitshur authored and hgiasac committed Apr 8, 2023
1 parent 104cfd9 commit fa10f16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ident/ident.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ func isTwoInitialisms(word string) (string, string, bool) {
// Only add entries that are highly unlikely to be non-initialisms.
// For instance, "ID" is fine (Freudian code is rare), but "AND" is not.
var initialisms = map[string]struct{}{
// These are the common initialisms from golint. Keep them in sync
// with https://gotools.org/github.com/golang/lint#commonInitialisms.
"ACL": {},
"API": {},
"ASCII": {},
Expand All @@ -201,6 +199,7 @@ var initialisms = map[string]struct{}{
"RAM": {},
"RHS": {},
"RPC": {},
"RSS": {},
"SLA": {},
"SMTP": {},
"SQL": {},
Expand All @@ -211,18 +210,15 @@ var initialisms = map[string]struct{}{
"UDP": {},
"UI": {},
"UID": {},
"UUID": {},
"URI": {},
"URL": {},
"UTF8": {},
"UUID": {},
"VM": {},
"XML": {},
"XMPP": {},
"XSRF": {},
"XSS": {},

// Additional common initialisms.
"RSS": {},
}

// isBrand reports whether word is a brand.
Expand All @@ -237,4 +233,9 @@ func isBrand(word string) (string, bool) {
// Only add entries that are highly unlikely to be non-brands.
var brands = map[string]string{
"github": "GitHub",
"gitlab": "GitLab",
"devops": "DevOps", // For https://en.wikipedia.org/wiki/DevOps.
// For https://docs.github.com/en/graphql/reference/enums#fundingplatform.
"issuehunt": "IssueHunt",
"lfx": "LFX",
}
1 change: 1 addition & 0 deletions ident/ident_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func TestName_ToMixedCaps(t *testing.T) {
{in: ident.Name{"client", "Mutation", "Id"}, want: "ClientMutationID"},
{in: ident.Name{"CLIENT", "MUTATION", "ID"}, want: "ClientMutationID"},
{in: ident.Name{"github", "logo"}, want: "GitHubLogo"},
{in: ident.Name{"AZURE", "DEVOPS"}, want: "AzureDevOps"},
}
for _, tc := range tests {
got := tc.in.ToMixedCaps()
Expand Down

0 comments on commit fa10f16

Please sign in to comment.