Skip to content

Commit 63e5492

Browse files
committed
ci: integrate typos spell checker into CI workflow
Add the crate-ci/typos GitHub Action to automatically catch spelling errors in future PRs. This includes: - New `.github/workflows/typos.yaml` workflow that runs on pushes to dev, pull requests, and manual dispatch - `_typos.toml` configuration to suppress false positives from non-English READMEs, test fixtures, certificate data, CLI flag short names, and intentional identifiers - Fix genuine typos found by the tool: - `PostReuestsHandlerRequest` -> `PostRequestsHandlerRequest` - `fiter` -> `filter` - `thant` -> `that` - `seperate` -> `separate` - `ExludedDastTmplStats` -> `ExcludedDastTmplStats` - `splitted` -> `split` (local variables) - `formated` -> `formatted` (local variables) - Rename `worflow_loader.go` -> `workflow_loader.go` Fixes #6532
1 parent b5cb4cc commit 63e5492

13 files changed

Lines changed: 103 additions & 22 deletions

File tree

.github/workflows/typos.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 🔤 Typos
2+
3+
on:
4+
push:
5+
branches: ["dev"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
typos:
15+
name: "Spell Check"
16+
if: ${{ !endsWith(github.actor, '[bot]') }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: crate-ci/typos@v1.28.4

_typos.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[files]
2+
extend-exclude = [
3+
# Non-English translations
4+
"README_CN.md",
5+
"README_ES.md",
6+
"README_ID.md",
7+
"README_JP.md",
8+
"README_KR.md",
9+
"README_PT-BR.md",
10+
"README_TR.md",
11+
# Test fixtures and data files
12+
"integration_tests/",
13+
"pkg/input/formats/testdata/",
14+
"pkg/output/stats/waf/",
15+
# Deserialization test data
16+
"pkg/protocols/common/helpers/deserialization/testdata/",
17+
# Certificate/encoded data in test utilities
18+
"pkg/testutils/integration.go",
19+
# Vendor directory
20+
"vendor/",
21+
# Go checksum file
22+
"go.sum",
23+
]
24+
25+
[default.extend-identifiers]
26+
# Go identifiers that cannot be renamed without breaking API
27+
MisMatched = "MisMatched"
28+
NoopWriter = "NoopWriter"
29+
AllowdTypes = "AllowdTypes"
30+
31+
[default.extend-words]
32+
# Variable name used for flow annotations
33+
fo = "fo"
34+
# Serbian test data in XML
35+
alo = "alo"
36+
# SQL test data (Spanish)
37+
algoritmos = "algoritmos"
38+
# Base64/hex encoded test data
39+
Noo = "Noo"
40+
# Certificate data fragments
41+
ba = "ba"
42+
nd = "nd"
43+
# Base64 encoded test data fragments
44+
Iif = "Iif"
45+
ser = "ser"
46+
47+
[type.go.extend-identifiers]
48+
# Short CLI flag names that appear in help strings
49+
ot = "ot"
50+
ue = "ue"
51+
ine = "ine"
52+
ines = "ines"
53+
hae = "hae"
54+
55+
[type.md.extend-identifiers]
56+
# CLI flag references in documentation
57+
ot = "ot"
58+
ue = "ue"
59+
ine = "ine"
60+
ines = "ines"
61+
hae = "hae"

cmd/tmc/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ func process(opts options) error {
196196
}
197197

198198
if opts.format {
199-
formatedTemplateData, isFormated, err := formatTemplate(dataString)
199+
formattedTemplateData, isFormatted, err := formatTemplate(dataString)
200200
if err != nil {
201201
gologger.Info().Label("format").Msg(logErrMsg(path, err, opts.debug, errFile))
202202
} else {
203-
if isFormated {
204-
_ = os.WriteFile(path, []byte(formatedTemplateData), 0644)
205-
dataString = formatedTemplateData
206-
gologger.Info().Label("format").Msgf("✅ formated template: %s\n", path)
203+
if isFormatted {
204+
_ = os.WriteFile(path, []byte(formattedTemplateData), 0644)
205+
dataString = formattedTemplateData
206+
gologger.Info().Label("format").Msgf("✅ formatted template: %s\n", path)
207207
}
208208
}
209209
}

internal/runner/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ func (r *Runner) displayExecutionInfo(store *loader.Store) {
860860
// only print these stats in verbose mode
861861
stats.ForceDisplayWarning(templates.ExcludedHeadlessTmplStats)
862862
stats.ForceDisplayWarning(templates.ExcludedCodeTmplStats)
863-
stats.ForceDisplayWarning(templates.ExludedDastTmplStats)
863+
stats.ForceDisplayWarning(templates.ExcludedDastTmplStats)
864864
stats.ForceDisplayWarning(templates.TemplatesExcludedStats)
865865
stats.ForceDisplayWarning(templates.ExcludedFileStats)
866866
stats.ForceDisplayWarning(templates.ExcludedSelfContainedStats)

internal/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (s *DASTServer) Start() error {
185185
return nil
186186
}
187187

188-
// PostReuestsHandlerRequest is the request body for the /fuzz POST handler.
188+
// PostRequestsHandlerRequest is the request body for the /fuzz POST handler.
189189
type PostRequestsHandlerRequest struct {
190190
RawHTTP string `json:"raw_http"`
191191
URL string `json:"url"`

lib/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type TemplateFilters struct {
5252
ExcludeSeverities string // filter by excluding severities (accepts CSV values of info, low, medium, high, critical)
5353
ProtocolTypes string // filter by protocol types
5454
ExcludeProtocolTypes string // filter by excluding protocol types
55-
Authors []string // fiter by author
55+
Authors []string // filter by author
5656
Tags []string // filter by tags present in template
5757
ExcludeTags []string // filter by excluding tags present in template
5858
IncludeTags []string // filter by including tags present in template

lib/tests/sdk_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestSimpleNuclei(t *testing.T) {
4242
defer ne.Close()
4343
}
4444

45-
// this is shared test so needs to be run as seperate process
45+
// this is shared test so needs to be run as separate process
4646
if env.GetEnvOrDefault("TestSimpleNuclei", false) {
4747
// run as new process
4848
cmd := exec.Command(os.Args[0], "-test.run=TestSimpleNuclei")
@@ -81,7 +81,7 @@ func TestSimpleNucleiRemote(t *testing.T) {
8181
require.Nil(t, err)
8282
defer ne.Close()
8383
}
84-
// this is shared test so needs to be run as seperate process
84+
// this is shared test so needs to be run as separate process
8585
if env.GetEnvOrDefault("TestSimpleNucleiRemote", false) {
8686
cmd := exec.Command(os.Args[0], "-test.run=TestSimpleNucleiRemote")
8787
cmd.Env = append(os.Environ(), "TestSimpleNucleiRemote=true")
@@ -155,7 +155,7 @@ func TestWithVarsNuclei(t *testing.T) {
155155
require.Nil(t, err)
156156
defer ne.Close()
157157
}
158-
// this is shared test so needs to be run as seperate process
158+
// this is shared test so needs to be run as separate process
159159
if env.GetEnvOrDefault("TestWithVarsNuclei", false) {
160160
cmd := exec.Command(os.Args[0], "-test.run=TestWithVarsNuclei")
161161
cmd.Env = append(os.Environ(), "TestWithVarsNuclei=true")

pkg/catalog/loader/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ func (store *Store) LoadTemplatesWithTags(templatesList, tags []string) ([]*temp
910910
store.logger.Print().Msgf("[%v] Tampered/Unsigned template at %v.\n", aurora.Yellow("WRN").String(), templatePath)
911911
}
912912
} else if parsed.IsFuzzableRequest() && !typesOpts.DAST {
913-
stats.Increment(templates.ExludedDastTmplStats)
913+
stats.Increment(templates.ExcludedDastTmplStats)
914914
if config.DefaultConfig.LogAllEvents {
915915
store.logger.Print().Msgf("[%v] -dast flag is required for DAST template '%s'.\n", aurora.Yellow("WRN").String(), templatePath)
916916
}

pkg/fuzz/component/path.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ func (q *Path) Parse(req *retryablehttp.Request) (bool, error) {
3535
q.req = req
3636
q.value = NewValue("")
3737

38-
splitted := strings.Split(req.Path, "/")
38+
split := strings.Split(req.Path, "/")
3939
values := make(map[string]interface{})
40-
for i, segment := range splitted {
40+
for i, segment := range split {
4141
if segment == "" && i == 0 {
4242
// Skip the first empty segment from leading "/"
4343
continue
@@ -88,20 +88,20 @@ func (q *Path) Delete(key string) error {
8888
// component rebuilt
8989
func (q *Path) Rebuild() (*retryablehttp.Request, error) {
9090
// Get the original path segments
91-
originalSplitted := strings.Split(q.req.Path, "/")
91+
originalSplit := strings.Split(q.req.Path, "/")
9292

9393
// Create a new slice to hold the rebuilt segments
94-
rebuiltSegments := make([]string, 0, len(originalSplitted))
94+
rebuiltSegments := make([]string, 0, len(originalSplit))
9595

9696
// Add the first empty segment (from leading "/")
97-
if len(originalSplitted) > 0 && originalSplitted[0] == "" {
97+
if len(originalSplit) > 0 && originalSplit[0] == "" {
9898
rebuiltSegments = append(rebuiltSegments, "")
9999
}
100100

101101
// Process each segment
102102
segmentIndex := 1 // 1-based indexing for our stored values
103-
for i := 1; i < len(originalSplitted); i++ {
104-
originalSegment := originalSplitted[i]
103+
for i := 1; i < len(originalSplit); i++ {
104+
originalSegment := originalSplit[i]
105105
if originalSegment == "" {
106106
// Skip empty segments
107107
continue

0 commit comments

Comments
 (0)