Skip to content

Commit 8adf8f1

Browse files
authored
Merge pull request #1683 from cloudflare/typos
Use typos for spell checks
2 parents 533c15f + dd468ec commit 8adf8f1

File tree

19 files changed

+68
-122
lines changed

19 files changed

+68
-122
lines changed

.github/spellcheck/config.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/spellcheck/wordlist.txt

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ jobs:
1515
show-progress: false
1616

1717
- name: Spellcheck
18-
uses: rojopolis/spellcheck-github-actions@2b78e363a487cd137993dc2cddc17a43c89bf7a1 # 0.57.0
19-
with:
20-
config_path: .github/spellcheck/config.yml
18+
uses: crate-ci/typos@v1.34.0
2119

2220
markdown:
2321
name: Markdownlint

_typos.toml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[default.extend-words]
2+
# Project-specific terms
3+
automaxprocs = "automaxprocs"
4+
cloudflare = "cloudflare"
5+
deduplicated = "deduplicated"
6+
endraw = "endraw"
7+
gitlab = "gitlab"
8+
golang = "golang"
9+
hoc = "hoc"
10+
humanize = "humanize"
11+
promql = "promql"
12+
prymitive = "prymitive"
13+
pushgateway = "pushgateway"
14+
rulefmt = "rulefmt"
15+
samber = "samber"
16+
symlinked = "symlinked"
17+
templated = "templated"
18+
tokenize = "tokenize"
19+
unmarshal = "unmarshal"
20+
21+
[default.extend-identifiers]
22+
# Variable name abbreviation for PromQLNode
23+
pn = "pn"
24+
# Variable name abbreviation for BitBucketCommentAnchor
25+
ba = "ba"
26+
27+
[files]
28+
extend-exclude = [
29+
"go.sum",
30+
# Test rules file contains intentional typos from real-world Prometheus rules
31+
"internal/parser/testrules.yml",
32+
# Test files with intentional typos in metric names or example data
33+
"cmd/pint/tests/*.txt",
34+
"internal/checks/*_test.snap",
35+
"internal/checks/*_test.go",
36+
# Documentation examples showing typos that pint catches
37+
"docs/checks/yaml/parse.md",
38+
]

internal/comments/comments.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ func parseSnooze(s string) (snz Snooze, err error) {
161161
return snz, nil
162162
}
163163

164-
func parseValue(typ Type, s string, line int) (CommentValue, error) {
164+
func parseValue(commentType Type, s string, line int) (CommentValue, error) {
165165
// nolint:exhaustive
166-
switch typ {
166+
switch commentType {
167167
case IgnoreFileType, IgnoreLineType, IgnoreBeginType, IgnoreEndType, IgnoreNextLineType:
168168
if s != "" {
169169
return nil, fmt.Errorf("unexpected comment suffix: %q", s)
@@ -342,20 +342,20 @@ func Parse(lineno int, text string) (comments []Comment) {
342342
return comments
343343
}
344344

345-
func Only[T any](src []Comment, typ Type) []T {
345+
func Only[T any](src []Comment, commentType Type) []T {
346346
dst := make([]T, 0, len(src))
347347
for _, c := range src {
348-
if c.Type != typ {
348+
if c.Type != commentType {
349349
continue
350350
}
351351
dst = append(dst, c.Value.(T))
352352
}
353353
return dst
354354
}
355355

356-
func IsRuleComment(typ Type) bool {
356+
func IsRuleComment(commentType Type) bool {
357357
// nolint:exhaustive
358-
switch typ {
358+
switch commentType {
359359
case RuleOwnerType, DisableType, SnoozeType, RuleSetType:
360360
return true
361361
}

internal/config/alerts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (as AlertsSettings) validate() error {
4040
return err
4141
}
4242
if as.MinCount <= 0 && sev > checks.Information {
43-
return fmt.Errorf("cannot set serverity to %q when minCount is 0", as.Severity)
43+
return fmt.Errorf("cannot set severity to %q when minCount is 0", as.Severity)
4444
}
4545
}
4646
return nil

internal/config/alerts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func TestAlertsSettings(t *testing.T) {
7272
MinCount: 0,
7373
Severity: "bug",
7474
},
75-
err: errors.New(`cannot set serverity to "bug" when minCount is 0`),
75+
err: errors.New(`cannot set severity to "bug" when minCount is 0`),
7676
},
7777
{
7878
conf: AlertsSettings{

internal/config/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ func TestConfigErrors(t *testing.T) {
19071907
severity = "bug"
19081908
}
19091909
}`,
1910-
err: `cannot set serverity to "bug" when minCount is 0`,
1910+
err: `cannot set severity to "bug" when minCount is 0`,
19111911
},
19121912
{
19131913
config: `rule {

internal/discovery/git_branch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ func isEntryIdentical(b, a *Entry) bool {
320320
return true
321321
}
322322

323-
func findRulesByName(entries []*Entry, name string, typ parser.RuleType) (nomatch, match []*Entry) {
323+
func findRulesByName(entries []*Entry, name string, ruleType parser.RuleType) (nomatch, match []*Entry) {
324324
for _, entry := range entries {
325-
if entry.PathError == nil && entry.Rule.Type() == typ && entry.Rule.Name() == name {
325+
if entry.PathError == nil && entry.Rule.Type() == ruleType && entry.Rule.Name() == name {
326326
match = append(match, entry)
327327
} else {
328328
nomatch = append(nomatch, entry)

internal/git/changes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ func getTypeForPath(cmd CommandRunner, commit, fpath string) PathType {
347347
}
348348

349349
// recursively find the final target of a symlink.
350-
func resolveSymlinkTarget(cmd CommandRunner, commit, fpath string, typ PathType) string {
351-
if typ != Symlink {
350+
func resolveSymlinkTarget(cmd CommandRunner, commit, fpath string, pathType PathType) string {
351+
if pathType != Symlink {
352352
return fpath
353353
}
354354
raw := string(getContentAtCommit(cmd, commit, fpath))

0 commit comments

Comments
 (0)