ci: integrate typos spell checker into CI pipeline#7021
ci: integrate typos spell checker into CI pipeline#7021jarvis117molt-dot wants to merge 2 commits intoprojectdiscovery:devfrom
Conversation
Fixes projectdiscovery#6532 - Add .github/workflows/typos.yaml to run typos on PRs and pushes to dev/main - Add _typos.toml configuration with exclusions for: - Non-English README translations - Test data/fixtures with intentional payloads (SQL injection, WAF regexes) - Integration test files with obfuscated strings - Fix existing typos found by the tool: - Reuests → Requests (server.go) - Exluded → Excluded (4 files) - seperate → separate (sdk_test.go) - fiter → filter (config.go) - pannel → panel (matcher-status.yaml) - noticable → noticeable (net-https-timeout.yaml) - formated → formatted, Formated → Formatted (main.go) - thant → than (flow_executor_test.go) - worflow → workflow (filename rename) - Allowd → Allowed (main.go) Ref: PR projectdiscovery#6521 by @dwisiswant0 (original typo fixes) Requested by: @dwisiswant0
Neo - PR Security ReviewNo security issues found 2 issues fixed in this PR Highlights
Hardening Notes
Comment |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis pull request fixes multiple typos across the codebase and introduces a typos configuration file. Changes include correcting misspelled identifiers (constants, variables, types), fixing comments and documentation text, and adding tooling configuration to prevent future typos. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/nuclei/main.go (1)
430-434:⚠️ Potential issue | 🔴 Critical
goflags.AllowedTypesdoes not exist — this change will fail to compile.The type exported by
github.com/projectdiscovery/goflags v0.1.74isAllowdTypes(a misspelling that exists in the library itself), notAllowedTypes. TheEnumVarPfunction signature expectsAllowdTypes, and the library's API documentation and examples confirm this is the only available type. UsingAllowedTypeswill result in an undefined type compilation error.Change
goflags.AllowedTypes{back togoflags.AllowdTypes{at lines 430–434.Proposed fix
- flagSet.EnumVarP(&options.ScanStrategy, "scan-strategy", "ss", goflags.EnumVariable(0), "strategy to use while scanning(auto/host-spray/template-spray)", goflags.AllowedTypes{ + flagSet.EnumVarP(&options.ScanStrategy, "scan-strategy", "ss", goflags.EnumVariable(0), "strategy to use while scanning(auto/host-spray/template-spray)", goflags.AllowdTypes{🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmd/nuclei/main.go` around lines 430 - 434, The code uses a non-existent type name goflags.AllowedTypes in the call to flagSet.EnumVarP when setting options.ScanStrategy; change that identifier to the actual exported type name goflags.AllowdTypes (note the library's misspelling) so the call to flagSet.EnumVarP(&options.ScanStrategy, "scan-strategy", "ss", goflags.EnumVariable(0), ...) compiles; update the composite literal to use goflags.AllowdTypes{ ... } with the same entries for scanstrategy.Auto/String(), HostSpray/String(), and TemplateSpray/String().
🧹 Nitpick comments (1)
_typos.toml (1)
25-46: Consider moving code-only identifiers from[default.extend-words]to[default.extend-identifiers].Entries in
[default.extend-words]suppress the check in all contexts — including prose, comments, and documentation. Entries likesplitted/Splitted,Noo,Iif,Fo,BA,Mis,alo,foare specifically code identifiers. Using[default.extend-identifiers]for these would restrict suppression to identifier contexts only, so a genuine use ofsplittedin documentation would still be caught.The empty
[default.extend-identifiers]section at line 47 is already present as a placeholder — these entries could be moved there.♻️ Proposed restructuring
[default.extend-words] -# Identifiers used in the codebase -splitted = "splitted" -Splitted = "Splitted" -# CLI help output uses abbreviated forms +# CLI help output uses abbreviated forms (appear in prose help text) ines = "ines" # JSONL(ines) in CLI help text ine = "ine" # JSONL(ine) in CLI help text ot = "ot" # flag abbreviation in CLI help ue = "ue" # flag abbreviation in CLI help hae = "hae" # appears in CLI output -# Test fixture identifiers -Noo = "Noo" algoritmos = "algoritmos" # Spanish word in fuzz playground test data - -# Test data with intentional non-words -Iif = "Iif" # expression test data -alo = "alo" # matcher test data -fo = "fo" # comment abbreviation in request_generator.go -Fo = "Fo" # severity test data -BA = "BA" # integration test constant -Mis = "Mis" # SSL field prefix (MisMatched) [default.extend-identifiers] +# Identifiers in codebase that should not be renamed in this PR +splitted = "splitted" +Splitted = "Splitted" +# Test fixture / constant identifiers +Noo = "Noo" +Iif = "Iif" +alo = "alo" +fo = "fo" +Fo = "Fo" +BA = "BA" +Mis = "Mis" +# goflags library type (library-level typo, cannot be changed here) +AllowdTypes = "AllowdTypes"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@_typos.toml` around lines 25 - 46, The entries under [default.extend-words] include code-only identifiers (e.g., splitted, Splitted, Noo, Iif, Fo, BA, Mis, alo, fo) which currently suppress spellcheck in all contexts; move those specific keys into the existing [default.extend-identifiers] section so they only disable checks for identifier contexts, leaving true words/docs still checked—update the TOML by removing those identifier entries from [default.extend-words] and adding them under [default.extend-identifiers], preserving their exact keys and values.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@cmd/nuclei/main.go`:
- Around line 430-434: The code uses a non-existent type name
goflags.AllowedTypes in the call to flagSet.EnumVarP when setting
options.ScanStrategy; change that identifier to the actual exported type name
goflags.AllowdTypes (note the library's misspelling) so the call to
flagSet.EnumVarP(&options.ScanStrategy, "scan-strategy", "ss",
goflags.EnumVariable(0), ...) compiles; update the composite literal to use
goflags.AllowdTypes{ ... } with the same entries for scanstrategy.Auto/String(),
HostSpray/String(), and TemplateSpray/String().
---
Nitpick comments:
In `@_typos.toml`:
- Around line 25-46: The entries under [default.extend-words] include code-only
identifiers (e.g., splitted, Splitted, Noo, Iif, Fo, BA, Mis, alo, fo) which
currently suppress spellcheck in all contexts; move those specific keys into the
existing [default.extend-identifiers] section so they only disable checks for
identifier contexts, leaving true words/docs still checked—update the TOML by
removing those identifier entries from [default.extend-words] and adding them
under [default.extend-identifiers], preserving their exact keys and values.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
.github/workflows/typos.yamlis excluded by!**/*.yamlintegration_tests/protocols/http/matcher-status.yamlis excluded by!**/*.yamlintegration_tests/protocols/network/net-https-timeout.yamlis excluded by!**/*.yaml
📒 Files selected for processing (12)
_typos.tomlcmd/nuclei/main.gocmd/tmc/main.gointernal/runner/runner.gointernal/server/server.golib/config.golib/tests/sdk_test.gopkg/catalog/loader/loader.gopkg/model/workflow_loader.gopkg/templates/parser_stats.gopkg/templates/stats.gopkg/tmplexec/flow/flow_executor_test.go
|
Thanks for the thorough review @coderabbitai! Quick clarifications: Re: Re: nitpick on extend-words vs extend-identifiers — Already restructured in the latest commit. Code identifiers ( All review items from both Neo and CodeRabbit are addressed. Ready for maintainer review. |
|
Tip For best results, initiate chat on the files or code changes.
✅ ✅ Configuration restructuring — Great work moving the code identifiers to All points are clear. Best of luck with the maintainer review! 🚀 |
Fixes #6532
Integrates the typos spell checker into the CI pipeline as requested by @dwisiswant0 in #6521.
Changes
CI Workflow
.github/workflows/typos.yaml— Runs typos on PRs and pushes todev/mainbranches usingcrate-ci/typos@v1.29.10Configuration
_typos.toml— Exclusions for:Typo Fixes (12 corrections across 15 files)
ReuestsRequestsExludedExcludedseperateseparatefiterfilterpannelpanelnoticablenoticeableformated/Formatedformatted/FormattedthantthanworflowworkflowAllowdAllowedVerification
$ typos --format brief # (no output — clean run)Checklist
devbranch_typos.tomlSummary by CodeRabbit