Skip to content

Commit 0bfccc5

Browse files
authored
Fixed some typos, add a spell check ci and others minor fix (redis#8890)
This PR adds a spell checker CI action that will fail future PRs if they introduce typos and spelling mistakes. This spell checker is based on blacklist of common spelling mistakes, so it will not catch everything, but at least it is also unlikely to cause false positives. Besides that, the PR also fixes many spelling mistakes and types, not all are a result of the spell checker we use. Here's a summary of other changes: 1. Scanned the entire source code and fixes all sorts of typos and spelling mistakes (including missing or extra spaces). 2. Outdated function / variable / argument names in comments 3. Fix outdated keyspace masks error log when we check `config.notify-keyspace-events` in loadServerConfigFromString. 4. Trim the white space at the end of line in `module.c`. Check: redis#7751 5. Some outdated https link URLs. 6. Fix some outdated comment. Such as: - In README: about the rdb, we used to said create a `thread`, change to `process` - dbRandomKey function coment (about the dictGetRandomKey, change to dictGetFairRandomKey) - notifyKeyspaceEvent fucntion comment (add type arg) - Some others minor fix in comment (Most of them are incorrectly quoted by variable names) 7. Modified the error log so that users can easily distinguish between TCP and TLS in `changeBindAddr`
1 parent 8a86bca commit 0bfccc5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+315
-269
lines changed

.github/.codespellrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[codespell]
2+
quiet-level = 2
3+
count =
4+
skip = ./deps,./src/crc16_slottable.h
5+
ignore-words = ./.github/wordlist.txt

.github/ISSUE_TEMPLATE/crash_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Paste the complete crash log between the quotes below. Please include a few line
1414
```
1515
```
1616

17-
**Aditional information**
17+
**Additional information**
1818

1919
1. OS distribution and version
2020
2. Steps to reproduce (if any)

.github/wordlist.txt

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ake
2+
bale
3+
fle
4+
fo
5+
gameboy
6+
mutli
7+
nd
8+
nees
9+
oll
10+
optin
11+
ot
12+
smove
13+
te
14+
tre
15+
cancelability

.github/workflows/spell-check.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# A CI action that using codespell to check spell.
2+
# .github/.codespellrc is a config file.
3+
# .github/wordlist.txt is a list of words that will ignore word checks.
4+
# More details please check the following link:
5+
# https://github.com/codespell-project/codespell
6+
name: Spellcheck
7+
8+
on:
9+
push:
10+
pull_request:
11+
12+
jobs:
13+
build:
14+
name: Spellcheck
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v2
20+
21+
- name: Install prerequisites
22+
run: sudo pip install codespell==2.0.0
23+
24+
- name: Spell check
25+
run: codespell --config=./.github/.codespellrc

CONTRIBUTING

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ all the support in the mailing list.
1818

1919
There is also an active community of Redis users at Stack Overflow:
2020

21-
http://stackoverflow.com/questions/tagged/redis
21+
https://stackoverflow.com/questions/tagged/redis
2222

2323
Issues and pull requests for documentation belong on the redis-doc repo:
2424

@@ -38,10 +38,10 @@ Here you'll see if there is consensus about your idea.
3838
2. If in step 1 you get an acknowledgment from the project leaders, use the
3939
following procedure to submit a patch:
4040

41-
a. Fork Redis on github ( http://help.github.com/fork-a-repo/ )
41+
a. Fork Redis on github ( https://docs.github.com/en/github/getting-started-with-github/fork-a-repo )
4242
b. Create a topic branch (git checkout -b my_branch)
4343
c. Push to your branch (git push origin my_branch)
44-
d. Initiate a pull request on github ( https://help.github.com/articles/creating-a-pull-request/ )
44+
d. Initiate a pull request on github ( https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request )
4545
e. Done :)
4646

4747
3. Keep in mind that we are very overloaded, so issues and PRs sometimes wait

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ aof.c and rdb.c
380380

381381
As you can guess from the names, these files implement the RDB and AOF
382382
persistence for Redis. Redis uses a persistence model based on the `fork()`
383-
system call in order to create a thread with the same (shared) memory
384-
content of the main Redis thread. This secondary thread dumps the content
383+
system call in order to create a process with the same (shared) memory
384+
content of the main Redis process. This secondary process dumps the content
385385
of the memory on disk. This is used by `rdb.c` to create the snapshots
386386
on disk and by `aof.c` in order to perform the AOF rewrite when the
387387
append only file gets too big.

sentinel.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ acllog-max-len 128
178178
# incoming connections (via ACL), and for outgoing connections (via
179179
# sentinel-user and sentinel-pass)
180180
#
181-
# The requirepass is not compatable with aclfile option and the ACL LOAD
181+
# The requirepass is not compatible with aclfile option and the ACL LOAD
182182
# command, these will cause requirepass to be ignored.
183183

184184
# sentinel sentinel-user <username>

src/acl.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ int ACLCheckPubsubPerm(client *c, int idx, int count, int literal, int *idxptr)
13631363

13641364
}
13651365

1366-
/* Check whether the command is ready to be exceuted by ACLCheckCommandPerm.
1366+
/* Check whether the command is ready to be executed by ACLCheckCommandPerm.
13671367
* If check passes, then check whether pub/sub channels of the command is
13681368
* ready to be executed by ACLCheckPubsubPerm */
13691369
int ACLCheckAllPerm(client *c, int *idxptr) {
@@ -2254,8 +2254,8 @@ void authCommand(client *c) {
22542254
* will just use "default" as username. */
22552255
robj *username, *password;
22562256
if (c->argc == 2) {
2257-
/* Mimic the old behavior of giving an error for the two commands
2258-
* from if no password is configured. */
2257+
/* Mimic the old behavior of giving an error for the two argument
2258+
* form if no password is configured. */
22592259
if (DefaultUser->flags & USER_FLAG_NOPASS) {
22602260
addReplyError(c,"AUTH <password> called without any password "
22612261
"configured for the default user. Are you sure "

src/aof.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ void flushAppendOnlyFile(int force) {
419419
* than two seconds this is still ok. Postpone again. */
420420
return;
421421
}
422-
/* Otherwise fall trough, and go write since we can't wait
422+
/* Otherwise fall through, and go write since we can't wait
423423
* over two seconds. */
424424
server.aof_delayed_fsync++;
425425
serverLog(LL_NOTICE,"Asynchronous AOF fsync is taking too long (disk is busy?). Writing the AOF buffer without waiting for fsync to complete, this may slow down Redis.");
@@ -1745,7 +1745,7 @@ int rewriteAppendOnlyFileBackground(void) {
17451745
server.aof_rewrite_scheduled = 0;
17461746
server.aof_rewrite_time_start = time(NULL);
17471747

1748-
/* We set appendseldb to -1 in order to force the next call to the
1748+
/* We set aof_selected_db to -1 in order to force the next call to the
17491749
* feedAppendOnlyFile() to issue a SELECT command, so the differences
17501750
* accumulated by the parent into server.aof_rewrite_buf will start
17511751
* with a SELECT statement and it will be safe to merge. */
@@ -1885,7 +1885,7 @@ void backgroundRewriteDoneHandler(int exitcode, int bysignal) {
18851885
oldfd = open(server.aof_filename,O_RDONLY|O_NONBLOCK);
18861886
} else {
18871887
/* AOF enabled */
1888-
oldfd = -1; /* We'll set this to the current AOF filedes later. */
1888+
oldfd = -1; /* We'll set this to the current AOF file descriptor later. */
18891889
}
18901890

18911891
/* Rename the temporary file. This will not unlink the target file if

src/bitops.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ int getBitfieldTypeFromArgument(client *c, robj *o, int *sign, int *bits) {
472472
return C_OK;
473473
}
474474

475-
/* This is an helper function for commands implementations that need to write
475+
/* This is a helper function for commands implementations that need to write
476476
* bits to a string object. The command creates or pad with zeroes the string
477477
* so that the 'maxbit' bit can be addressed. The object is finally
478478
* returned. Otherwise if the key holds a wrong type NULL is returned and
@@ -1025,7 +1025,7 @@ void bitfieldGeneric(client *c, int flags) {
10251025
return;
10261026
}
10271027

1028-
/* Lookup by making room up to the farest bit reached by
1028+
/* Lookup by making room up to the farthest bit reached by
10291029
* this operation. */
10301030
if ((o = lookupStringForBitCommand(c,
10311031
highest_write_offset)) == NULL) {

src/cli_common.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len)
166166
*
167167
* Do we still have data that was there prior to our buf? If so,
168168
* restore buffer to it's original state and report no new data was
169-
* writen.
169+
* written.
170170
*/
171171
if (sdslen(c->obuf) > buf_len) {
172172
sdsrange(c->obuf, 0, -(buf_len+1));

src/cli_common.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ typedef struct cliSSLconfig {
1616
char *cert;
1717
/* Private key file to authenticate with, or NULL */
1818
char *key;
19-
/* Prefered cipher list, or NULL (applies only to <= TLSv1.2) */
19+
/* Preferred cipher list, or NULL (applies only to <= TLSv1.2) */
2020
char* ciphers;
21-
/* Prefered ciphersuites list, or NULL (applies only to TLSv1.3) */
21+
/* Preferred ciphersuites list, or NULL (applies only to TLSv1.3) */
2222
char* ciphersuites;
2323
} cliSSLconfig;
2424

src/cluster.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ void clusterHandleConfigEpochCollision(clusterNode *sender) {
11851185
* CLUSTER nodes blacklist
11861186
*
11871187
* The nodes blacklist is just a way to ensure that a given node with a given
1188-
* Node ID is not readded before some time elapsed (this time is specified
1188+
* Node ID is not re-added before some time elapsed (this time is specified
11891189
* in seconds in CLUSTER_BLACKLIST_TTL).
11901190
*
11911191
* This is useful when we want to remove a node from the cluster completely:
@@ -4203,7 +4203,7 @@ sds clusterGenNodeDescription(clusterNode *node, int use_pport) {
42034203
"connected" : "disconnected");
42044204

42054205
/* Slots served by this instance. If we already have slots info,
4206-
* append it diretly, otherwise, generate slots only if it has. */
4206+
* append it directly, otherwise, generate slots only if it has. */
42074207
if (node->slots_info) {
42084208
ci = sdscatsds(ci, node->slots_info);
42094209
} else if (node->numslots > 0) {

src/config.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ void loadServerConfigFromString(char *config) {
581581
int flags = keyspaceEventsStringToFlags(argv[1]);
582582

583583
if (flags == -1) {
584-
err = "Invalid event class character. Use 'g$lshzxeA'.";
584+
err = "Invalid event class character. Use 'Ag$lshzxeKEtmd'.";
585585
goto loaderr;
586586
}
587587
server.notify_keyspace_events = flags;

src/connhelpers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* of connections from within a handler.
4242
*/
4343

44-
/* Incremenet connection references.
44+
/* Increment connection references.
4545
*
4646
* Inside a connection handler, we guarantee refs >= 1 so it is always
4747
* safe to connClose().

src/crcspeed.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ uint16_t crcspeed16big(uint16_t big_table[8][256], uint16_t crc_in, void *buf,
248248

249249
/* Return the CRC of buf[0..len-1] with initial crc, processing eight bytes
250250
at a time using passed-in lookup table.
251-
This selects one of two routines depending on the endianess of
251+
This selects one of two routines depending on the endianness of
252252
the architecture. */
253253
uint64_t crcspeed64native(uint64_t table[8][256], uint64_t crc, void *buf,
254254
size_t len) {

src/db.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ robj *dbRandomKey(redisDb *db) {
295295
* it could happen that all the keys are already logically
296296
* expired in the slave, so the function cannot stop because
297297
* expireIfNeeded() is false, nor it can stop because
298-
* dictGetRandomKey() returns NULL (there are keys to return).
298+
* dictGetFairRandomKey() returns NULL (there are keys to return).
299299
* To prevent the infinite loop we do some tries, but if there
300300
* are the conditions for an infinite loop, eventually we
301301
* return a key name that may be already expired. */

src/debug.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,7 @@ void disableWatchdog(void) {
19801980
* of microseconds, i.e. -10 means 100 nanoseconds. */
19811981
void debugDelay(int usec) {
19821982
/* Since even the shortest sleep results in context switch and system call,
1983-
* the way we achive short sleeps is by statistically sleeping less often. */
1983+
* the way we achieve short sleeps is by statistically sleeping less often. */
19841984
if (usec < 0) usec = (rand() % -usec) == 0 ? 1: 0;
19851985
if (usec) usleep(usec);
19861986
}

src/evict.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void evictionPoolAlloc(void) {
133133
EvictionPoolLRU = ep;
134134
}
135135

136-
/* This is an helper function for performEvictions(), it is used in order
136+
/* This is a helper function for performEvictions(), it is used in order
137137
* to populate the evictionPool with a few entries every time we want to
138138
* expire a key. Keys with idle time bigger than one of the current
139139
* keys are added. Keys are always added if there are free entries.

src/geo.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void addReplyDoubleDistance(client *c, double d) {
213213
* representing a point, and a GeoShape, appends this entry as a geoPoint
214214
* into the specified geoArray only if the point is within the search area.
215215
*
216-
* returns C_OK if the point is included, or REIDS_ERR if it is outside. */
216+
* returns C_OK if the point is included, or C_ERR if it is outside. */
217217
int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds member) {
218218
double distance = 0, xy[2];
219219

@@ -241,10 +241,10 @@ int geoAppendIfWithinShape(geoArray *ga, GeoShape *shape, double score, sds memb
241241
}
242242

243243
/* Query a Redis sorted set to extract all the elements between 'min' and
244-
* 'max', appending them into the array of geoPoint structures 'gparray'.
244+
* 'max', appending them into the array of geoPoint structures 'geoArray'.
245245
* The command returns the number of elements added to the array.
246246
*
247-
* Elements which are farest than 'radius' from the specified 'x' and 'y'
247+
* Elements which are farther than 'radius' from the specified 'x' and 'y'
248248
* coordinates are not included.
249249
*
250250
* The ability of this function to append to an existing set of points is
@@ -330,7 +330,7 @@ void scoresOfGeoHashBox(GeoHashBits hash, GeoHashFix52Bits *min, GeoHashFix52Bit
330330
*
331331
* To get the min score we just use the initial hash value left
332332
* shifted enough to get the 52 bit value. Later we increment the
333-
* 6 bit prefis (see the hash.bits++ statement), and get the new
333+
* 6 bit prefix (see the hash.bits++ statement), and get the new
334334
* prefix: 101011, which we align again to 52 bits to get the maximum
335335
* value (which is excluded from the search). So we get everything
336336
* between the two following scores (represented in binary):

src/geohash_helper.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ GeoHashFix52Bits geohashAlign52Bits(const GeoHashBits hash) {
216216
return bits;
217217
}
218218

219-
/* Calculate distance using haversin great circle distance formula. */
219+
/* Calculate distance using haversine great circle distance formula. */
220220
double geohashGetDistance(double lon1d, double lat1d, double lon2d, double lat2d) {
221221
double lat1r, lon1r, lat2r, lon2r, u, v;
222222
lat1r = deg_rad(lat1d);

src/hyperloglog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ int hllSparseSet(robj *o, long index, uint8_t count) {
899899
* the element belongs to is incremented if needed.
900900
*
901901
* This function is actually a wrapper for hllSparseSet(), it only performs
902-
* the hashshing of the element to obtain the index and zeros run length. */
902+
* the hashing of the element to obtain the index and zeros run length. */
903903
int hllSparseAdd(robj *o, unsigned char *ele, size_t elesize) {
904904
long index;
905905
uint8_t count = hllPatLen(ele,elesize,&index);

src/intset.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ int intsetValidateIntegrity(const unsigned char *p, size_t size, int deep) {
306306
return 0;
307307
}
308308

309-
/* check that the size matchies (all records are inside the buffer). */
309+
/* check that the size matches (all records are inside the buffer). */
310310
uint32_t count = intrev32ifbe(is->length);
311311
if (sizeof(*is) + count*record_size != size)
312312
return 0;

src/listpack.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
(p)[5] = ((v)>>8)&0xff; \
117117
} while(0)
118118

119-
/* Validates that 'p' is not ouside the listpack.
119+
/* Validates that 'p' is not outside the listpack.
120120
* All function that return a pointer to an element in the listpack will assert
121121
* that this element is valid, so it can be freely used.
122122
* Generally functions such lpNext and lpDelete assume the input pointer is
@@ -125,7 +125,7 @@
125125
assert((p) >= (lp)+LP_HDR_SIZE && (p) < (lp)+lpGetTotalBytes((lp))); \
126126
} while (0)
127127

128-
/* Similar to the above, but validates the entire element lenth rather than just
128+
/* Similar to the above, but validates the entire element length rather than just
129129
* it's pointer. */
130130
#define ASSERT_INTEGRITY_LEN(lp, p, len) do { \
131131
assert((p) >= (lp)+LP_HDR_SIZE && (p)+(len) < (lp)+lpGetTotalBytes((lp))); \
@@ -218,7 +218,7 @@ int lpStringToInt64(const char *s, unsigned long slen, int64_t *value) {
218218
/* Create a new, empty listpack.
219219
* On success the new listpack is returned, otherwise an error is returned.
220220
* Pre-allocate at least `capacity` bytes of memory,
221-
* over-allocated memory can be shrinked by `lpShrinkToFit`.
221+
* over-allocated memory can be shrunk by `lpShrinkToFit`.
222222
* */
223223
unsigned char *lpNew(size_t capacity) {
224224
unsigned char *lp = lp_malloc(capacity > LP_HDR_SIZE+1 ? capacity : LP_HDR_SIZE+1);
@@ -416,7 +416,7 @@ uint32_t lpCurrentEncodedSizeUnsafe(unsigned char *p) {
416416
}
417417

418418
/* Return bytes needed to encode the length of the listpack element pointed by 'p'.
419-
* This includes just the encodign byte, and the bytes needed to encode the length
419+
* This includes just the encoding byte, and the bytes needed to encode the length
420420
* of the element (excluding the element data itself)
421421
* If the element encoding is wrong then 0 is returned. */
422422
uint32_t lpCurrentEncodedSizeBytes(unsigned char *p) {
@@ -641,7 +641,7 @@ unsigned char *lpGet(unsigned char *p, int64_t *count, unsigned char *intbuf) {
641641
*
642642
* If 'newp' is not NULL, at the end of a successful call '*newp' will be set
643643
* to the address of the element just added, so that it will be possible to
644-
* continue an interation with lpNext() and lpPrev().
644+
* continue an interaction with lpNext() and lpPrev().
645645
*
646646
* For deletion operations ('ele' set to NULL) 'newp' is set to the next
647647
* element, on the right of the deleted one, or to NULL if the deleted element
@@ -879,7 +879,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) {
879879
if (!lenbytes)
880880
return 0;
881881

882-
/* make sure the encoded entry length doesn't rech outside the edge of the listpack */
882+
/* make sure the encoded entry length doesn't reach outside the edge of the listpack */
883883
if (OUT_OF_RANGE(p + lenbytes))
884884
return 0;
885885

@@ -888,7 +888,7 @@ int lpValidateNext(unsigned char *lp, unsigned char **pp, size_t lpbytes) {
888888
unsigned long encodedBacklen = lpEncodeBacklen(NULL,entrylen);
889889
entrylen += encodedBacklen;
890890

891-
/* make sure the entry doesn't rech outside the edge of the listpack */
891+
/* make sure the entry doesn't reach outside the edge of the listpack */
892892
if (OUT_OF_RANGE(p + entrylen))
893893
return 0;
894894

@@ -925,7 +925,7 @@ int lpValidateIntegrity(unsigned char *lp, size_t size, int deep){
925925
if (!deep)
926926
return 1;
927927

928-
/* Validate the invividual entries. */
928+
/* Validate the individual entries. */
929929
uint32_t count = 0;
930930
unsigned char *p = lpFirst(lp);
931931
while(p) {

src/lolwut.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void lolwutCommand(client *c) {
8484
}
8585
}
8686

87-
/* ========================== LOLWUT Canvase ===============================
87+
/* ========================== LOLWUT Canvas ===============================
8888
* Many LOLWUT versions will likely print some computer art to the screen.
8989
* This is the case with LOLWUT 5 and LOLWUT 6, so here there is a generic
9090
* canvas implementation that can be reused. */

0 commit comments

Comments
 (0)