chore(typos): fix typos#6521
Conversation
WalkthroughThis PR primarily corrects typos in comments and strings across many files. It also renames exported/public identifiers in the frequency tracker and headless engine, adds input validation and a parameter rename in payload generator parsing, updates one test’s env var and cases, and standardizes several log/error messages. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Gen as Generators.parsePayloadsWithAggression
participant V as Payload Spec (map)
participant Err as Error
Caller->>Gen: parsePayloadsWithAggression(name, V, aggression)
Gen->>V: Read levels (low/medium/high)
alt Level value is list
Gen-->>Caller: Aggregated payloads (by aggression)
else Level value not a list
Gen->>Err: Construct validation error
Gen-->>Caller: error
end
note over Gen: Parameter renamed to "aggression"\nValidation added for payload level types
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ 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.
Actionable comments posted: 3
🧹 Nitpick comments (2)
pkg/fuzz/analyzers/time/time_delay.go (1)
64-78: Spelling fixes — LGTMRenames are correct; behavior unchanged.
Optional: DefaultLowSleepTimeSeconds is float64; consider an int-typed default (or a local const) to avoid repeated casts like int(DefaultLowSleepTimeSeconds).
Also applies to: 80-96
pkg/protocols/common/generators/generators.go (1)
78-86: Avoid variable shadowing in parsePayloadsWithAggressionRename the loop’s inner
vto improve clarity:- for k, v := range v { - if _, ok := v.([]interface{}); !ok { + for k, levelValue := range v { + if _, ok := levelValue.([]interface{}); !ok { return nil, errors.Errorf("only lists are supported for aggression levels payloads") } var ok bool switch k { case "low": - payloadsLevels.Low, ok = v.([]interface{}) + payloadsLevels.Low, ok = levelValue.([]interface{}) case "medium": - payloadsLevels.Medium, ok = v.([]interface{}) + payloadsLevels.Medium, ok = levelValue.([]interface{}) case "high": - payloadsLevels.High, ok = v.([]interface{}) + payloadsLevels.High, ok = levelValue.([]interface{})Run
go vet -shadowafter applying this change.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
pkg/input/formats/testdata/openapi.yamlis excluded by!**/*.yamlpkg/js/generated/ts/mysql.tsis excluded by!**/generated/**
📒 Files selected for processing (34)
pkg/catalog/config/nucleiconfig.go(1 hunks)pkg/catalog/loader/remote_loader.go(1 hunks)pkg/fuzz/analyzers/time/time_delay.go(1 hunks)pkg/fuzz/dataformat/json.go(1 hunks)pkg/fuzz/frequency/tracker.go(6 hunks)pkg/fuzz/parts.go(1 hunks)pkg/installer/versioncheck.go(1 hunks)pkg/js/CONTRIBUTE.md(4 hunks)pkg/js/compiler/compiler.go(1 hunks)pkg/js/compiler/pool.go(1 hunks)pkg/js/devtools/tsgen/parser.go(1 hunks)pkg/js/global/helpers.go(1 hunks)pkg/js/libs/mysql/mysql.go(1 hunks)pkg/js/libs/structs/smbexploit.js(1 hunks)pkg/output/output.go(1 hunks)pkg/protocols/code/code.go(2 hunks)pkg/protocols/common/generators/generators.go(3 hunks)pkg/protocols/headless/engine/page_actions.go(2 hunks)pkg/protocols/headless/engine/page_actions_test.go(2 hunks)pkg/protocols/http/request.go(7 hunks)pkg/protocols/http/request_annotations.go(1 hunks)pkg/protocols/network/network.go(1 hunks)pkg/protocols/protocols.go(1 hunks)pkg/reporting/trackers/linear/jsonutil/jsonutil.go(2 hunks)pkg/scan/scan_context.go(2 hunks)pkg/templates/compile.go(1 hunks)pkg/templates/template_sign.go(1 hunks)pkg/templates/templates_doc.go(2 hunks)pkg/templates/workflows.go(1 hunks)pkg/tmplexec/README.md(1 hunks)pkg/tmplexec/flow/README.md(2 hunks)pkg/tmplexec/multiproto/multi.go(1 hunks)pkg/types/nucleierr/kinds.go(1 hunks)pkg/utils/json/doc.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.go: Format Go code using go fmt
Run static analysis with go vet
Files:
pkg/js/compiler/compiler.gopkg/fuzz/dataformat/json.gopkg/protocols/headless/engine/page_actions.gopkg/catalog/loader/remote_loader.gopkg/protocols/protocols.gopkg/js/global/helpers.gopkg/fuzz/parts.gopkg/js/compiler/pool.gopkg/protocols/http/request_annotations.gopkg/protocols/network/network.gopkg/templates/workflows.gopkg/js/devtools/tsgen/parser.gopkg/tmplexec/multiproto/multi.gopkg/installer/versioncheck.gopkg/js/libs/mysql/mysql.gopkg/templates/template_sign.gopkg/templates/templates_doc.gopkg/protocols/http/request.gopkg/templates/compile.gopkg/protocols/headless/engine/page_actions_test.gopkg/output/output.gopkg/fuzz/analyzers/time/time_delay.gopkg/utils/json/doc.gopkg/fuzz/frequency/tracker.gopkg/protocols/common/generators/generators.gopkg/types/nucleierr/kinds.gopkg/catalog/config/nucleiconfig.gopkg/protocols/code/code.gopkg/scan/scan_context.gopkg/reporting/trackers/linear/jsonutil/jsonutil.go
pkg/protocols/**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
Each protocol implementation must provide a Request interface with methods Compile(), ExecuteWithResults(), Match(), and Extract()
Files:
pkg/protocols/headless/engine/page_actions.gopkg/protocols/protocols.gopkg/protocols/http/request_annotations.gopkg/protocols/network/network.gopkg/protocols/http/request.gopkg/protocols/headless/engine/page_actions_test.gopkg/protocols/common/generators/generators.gopkg/protocols/code/code.go
🧬 Code graph analysis (2)
pkg/protocols/http/request_annotations.go (1)
pkg/types/nucleierr/kinds.go (1)
ErrTemplateLogic(12-12)
pkg/fuzz/analyzers/time/time_delay.go (1)
pkg/fuzz/analyzers/time/analyzer.go (1)
DefaultLowSleepTimeSeconds(26-26)
🔇 Additional comments (21)
pkg/templates/template_sign.go (1)
43-43: LGTM—typo corrected.Thanks for tightening up the comment; no further action needed.
pkg/protocols/headless/engine/page_actions_test.go (1)
648-648: Approve typo fix for environment variable
No occurrences of the oldRESTRICED_LOCAL_NETWORK_ACCESSremain in code, docs, or configs; test updates are self-contained.pkg/installer/versioncheck.go (1)
86-86: LGTM!Typo correction in comment improves code readability.
pkg/fuzz/dataformat/json.go (1)
15-15: LGTM!Typo correction in comment improves code readability.
pkg/js/CONTRIBUTE.md (1)
12-12: LGTM!Multiple typo corrections in the documentation improve readability and professionalism.
Also applies to: 36-36, 50-50, 63-63
pkg/tmplexec/multiproto/multi.go (1)
69-69: LGTM!Typo correction in comment improves code readability.
pkg/catalog/config/nucleiconfig.go (1)
353-353: LGTM!Typo correction in comment improves code readability.
pkg/tmplexec/README.md (1)
3-3: LGTM!Typo correction in documentation improves readability.
pkg/protocols/http/request.go (1)
62-64: LGTM!Multiple typo corrections in comments improve code readability and professionalism.
Also applies to: 153-153, 206-206, 235-235, 393-393, 422-422, 956-956
pkg/protocols/protocols.go (1)
339-339: LGTM!Typo correction in comment improves code readability.
pkg/js/libs/structs/smbexploit.js (1)
69-69: LGTM! Typo corrected.The spelling correction from "Negotation" to "Negotiation" improves code readability.
pkg/js/devtools/tsgen/parser.go (1)
75-75: LGTM! Typo corrected.The spelling correction from "funtions" to "functions" improves comment accuracy.
pkg/reporting/trackers/linear/jsonutil/jsonutil.go (2)
44-44: LGTM! Terminology standardized.The change from "unmarshaling" to "unmarshalling" improves consistency with other documentation (e.g., pkg/utils/json/doc.go).
57-57: LGTM! Terminology standardized.Consistent with the terminology change on Line 44.
pkg/catalog/loader/remote_loader.go (1)
100-100: LGTM! Error message corrected.The grammar correction from "unexpect status" to "unexpected status" improves the user-facing error message.
pkg/utils/json/doc.go (1)
9-9: LGTM! Terminology standardized.The change from "unmarshaling" to "unmarshalling" maintains consistency with the terminology used in pkg/reporting/trackers/linear/jsonutil/jsonutil.go.
pkg/templates/compile.go (1)
35-35: LGTM! Typo corrected.The spelling correction from "verfied" to "verified" improves comment accuracy.
pkg/tmplexec/flow/README.md (1)
117-117: LGTM! Typo corrected.The spelling correction from "ceritificate" to "certificate" improves documentation quality.
pkg/templates/workflows.go (1)
107-107: LGTM! Typo corrected.The spelling correction from "unverfied" to "unverified" improves comment accuracy and maintains consistency with similar corrections in pkg/templates/compile.go.
pkg/protocols/http/request_annotations.go (1)
34-37: Typo-only comment fixes — LGTMNo functional change. Safe to merge.
Also applies to: 39-41
pkg/templates/templates_doc.go (1)
1405-1405: Doc wording corrections — LGTM Verified this is an auto-generated file; ensure docgen outputs include these fixes at lines 1405 and 2110–2111.
|
I think we can safely skip backward compat here since it's only used internally and not exposed through the SDK, and without breaking anything downstream ofc. @coderabbitai resolve. @pstoeckle Thanks for this! Looks like we should probably plug this into CI too. - https://github.com/crate-ci/typos/blob/master/docs/github-action.md |
@coderabbitai create an issue for that. |
|
@dwisiswant0: Thank you for confirming the backward compatibility approach! I'll resolve all the review comments now. That's a great suggestion about integrating the typos tool into CI - it would help catch typos automatically in future PRs and maintain code quality consistently. ✅ Actions performedComments resolved. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 54 @dwisiswant0: I've created issue #6532 to track the integration of the typos tool into CI. The issue has been assigned to you. |
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
Proposed changes
Fixed some typos using
typosChecklist
Summary by CodeRabbit
Bug Fixes
Refactor
Documentation
Tests