-
Notifications
You must be signed in to change notification settings - Fork 519
CI: add dupword linter and fix issues #6474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds the "dupword" linter to enforce detection of duplicate words in code comments, inspired by external contributions. It addresses all identified duplicate word issues throughout the codebase by correcting comments and documentation that contained repeated words.
- Configures the dupword linter in
.golangci.ymlto check comments only, with an exception for "long long" - Fixes duplicate words in comments across 40+ files spanning utilities, network, ledger, data structures, and daemon components
- Updates the golangci-lint version to support the new linter
Reviewed Changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .golangci.yml | Adds dupword linter configuration with comments-only mode |
| scripts/buildtools/versions | Updates golangci-lint version to support dupword linter |
| util/rateLimit.go | Fixes "are are" → "are" in congestion manager comment |
| util/metrics/gauge_test.go | Fixes "the the" → "in the" in test comment |
| util/metrics/counter_test.go | Fixes three instances of "the the" → "the" in test comments |
| tools/network/resolver.go | Fixes "the the" → "the" in DNS resolver field comment |
| tools/network/dnssec/client.go | Fixes "and and" → "and" in QueryRRSet function comment |
| test/e2e-go/features/catchup/basicCatchup_test.go | Fixes "the the" → "that" in test function comment |
| shared/algoh/config.go | Fixes two instances of "the the" → "the" in Save and Dump function comments |
| rpcs/blockService_test.go | Combines two comment lines into one, removing duplicate "timestamp" |
| protocol/codec.go | Fixes "from from" → "from" in Decode function comment |
| node/node_test.go | Fixes "to to" → "to" in test comment |
| network/wsNetwork_test.go | Fixes "dropped dropped" → "dropped" in test comment |
| network/wsNetwork.go | Fixes "out of" → "out of" and removes redundant "and" in filterASCII comment |
| network/websocketProxy_test.go | Fixes "to to" → "to" in package comment |
| network/p2pNetwork.go | Fixes "from from" → "from" in GetPeers comment |
| network/netidentity_test.go | Fixes "not not" → "not" in test comment |
| network/hybridNetwork_test.go | Fixes "and and" → "and" in test comment |
| network/gossipNode.go | Fixes "be be" → "be" in MessageValidatorHandler interface comment |
| netdeploy/networkTemplate.go | Fixes "which is" → "which" in TemplateKMDConfig comment |
| logging/telemetry.go | Fixes "the the" → "the" in ReadTelemetryConfigOrDefault comment |
| logging/cyclicWriter.go | Fixes "the the" → "the" in Write function comment |
| ledger/store/trackerdb/testinterface.go | Fixes capitalization in package comment |
| ledger/store/trackerdb/generickv/migrations.go | Fixes "at at" → "at a" in migration comment |
| ledger/ledgercore/statedelta.go | Fixes "single single" → "single" in ModifiedCreatable comment |
| ledger/eval/txntracer_test.go | Improves comment clarity by replacing duplicate "addrs[1]" reference |
| ledger/catchupaccessor.go | Removes duplicate "TotalAccounts" in comment |
| ledger/catchpointtracker_test.go | Fixes "the the" → "the" in test comment |
| ledger/boxtxn_test.go | Fixes "the the" → "the" and "have have" → "have" in test comments |
| ledger/acctupdates_test.go | Fixes "creator creator" → "creator" in test comment |
| ledger/acctonline_test.go | Fixes "next next" → "next" in test comment |
| ledger/acctonline.go | Adds nolint:dupword directive for intentional duplicate "ver1" usage |
| ledger/acctdeltas_test.go | Fixes "and and" → "and" in test comment and adds nolint directive |
| data/transactions/logic/evalStateful_test.go | Fixes "it it" → "is" and "the the" → "the" in test comments |
| data/transactions/logic/eval.go | Fixes "with with" → "with" and "to to" → "to" in function comments |
| data/transactions/logic/assembler_test.go | Fixes "really really" → "really" in test comment |
| data/pools/transactionPool.go | Fixes "the the" → "the" in addToPendingBlockEvaluatorOnce comment |
| data/basics/userBalance.go | Fixes "is is" → "is" in AccountData field comment |
| data/appRateLimiter_test.go | Fixes "next next" → "next" in test comment |
| daemon/kmd/wallet/driver/sqlite_crypto.go | Fixes "the the" → "the" in extractKeyWithIndex comment |
| daemon/kmd/config/config.go | Fixes "the the" → "the" in LoadKMDConfig comment |
| daemon/kmd/api/v1/handlers.go | Fixes "in the" → "in" in errorResponse comment |
| daemon/algod/api/server/v1/routes/routes.go | Improves comment clarity by removing "v1" reference |
| config/localTemplate.go | Fixes "in in" → "in" in UseXForwardedForAddressField comment |
| agreement/state_machine_test.go | Fixes "test test" → "test" in deterministicTraceTestCase comment |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: John Jannotti <jannotti@gmail.com>
Summary
Inspired by helpful open source contributions in #6463 and #6471 this adds the "dupword" linter and also fixes all the issues it found.
This will enforce new duplicate words don't creep into the codebase, obviating the need for future contributions like those in #6463 and #6471.
As a bonus, this PR also enables the misspell linter for test code (it was already running on non-test code) to pre-empt the need for typo PR fixes in the future.
Test Plan
Linter should pass