Fix typos and replace 'codespell' with 'typos' (#72)

Uses https://github.com/taiki-e/install-action to install
https://github.com/crate-ci/typos in CI

This finds many more/different typos than
https://github.com/codespell-project/codespell , while having very few
false positives.

Signed-off-by: John Vandenberg <jayvdb@gmail.com>
This commit is contained in:
John Vandenberg 2024-04-01 03:38:22 +08:00 committed by GitHub
parent af1b0de92d
commit 253fe9dced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 114 additions and 89 deletions

View File

@ -1,5 +0,0 @@
[codespell]
quiet-level = 2
count =
skip = ./deps,./src/crc16_slottable.h,tmp*,./.git,./lcov-html
ignore-words = ./.codespell/wordlist.txt

View File

@ -1 +0,0 @@
codespell==2.2.5

View File

@ -1,21 +0,0 @@
ake
bale
fle
fo
gameboy
mutli
nd
nees
oll
optin
ot
smove
te
tre
cancelability
ist
statics
filetest
ro
exat
clen

61
.config/typos.toml Normal file
View File

@ -0,0 +1,61 @@
# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos
[files]
extend-exclude = [
"deps/",
# crc16_slottable is primarily pre-generated random strings.
"src/crc16_slottable.h",
]
[default.extend-words]
exat = "exat"
optin = "optin"
smove = "smove"
[type.c]
extend-ignore-re = [
"BA3E2571", # sha1.c
"D4C4DAA4", # sha1.c
"Georg Nees",
"\\[l\\]ist", # eval.c
]
[type.tcl]
extend-ignore-re = [
"DUMPed",
]
[type.sv.extend-identifiers]
# sv = .h
module_gil_acquring = "module_gil_acquring"
[type.c.extend-identifiers]
clen = "clen"
fle = "fle"
module_gil_acquring = "module_gil_acquring"
nd = "nd"
ot = "ot"
[type.tcl.extend-identifiers]
fo = "fo"
oll = "oll"
stressers = "stressers"
[type.sv.extend-words]
# sv = .h
fo = "fo"
seeked = "seeked"
[type.c.extend-words]
fo = "fo"
limite = "limite"
seeked = "seeked"
tre = "tre"
[type.systemd.extend-words]
# systemd = .conf
ake = "ake"
[type.tcl.extend-words]
fo = "fo"
tre = "tre"

View File

@ -2,14 +2,10 @@
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
---
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: pip
directory: /.codespell
schedule:
interval: weekly

View File

@ -18,15 +18,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: pip cache
uses: actions/cache@v4
- name: Install typos
uses: taiki-e/install-action@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install prerequisites
run: sudo pip install -r ./.codespell/requirements.txt
tool: typos
- name: Spell check
run: codespell --config=./.codespell/.codespellrc
run: typos --config=./.config/typos.toml

View File

@ -32,7 +32,7 @@
* (if the flag was 0 -> set to 1, if it's already 1 -> do nothing, but the final result is that the flag is set),
* and also it has a full barrier (__sync_lock_test_and_set has acquire barrier).
*
* NOTE2: Unlike other atomic type, which aren't guaranteed to be lock free, c11 atmoic_flag does.
* NOTE2: Unlike other atomic type, which aren't guaranteed to be lock free, c11 atomic_flag does.
* To check whether a type is lock free, atomic_is_lock_free() can be used.
* It can be considered to limit the flag type to atomic_flag to improve performance.
*

View File

@ -36,7 +36,7 @@
*
* * Execute Lua code, assuming that the code is located on
* the top of the Lua stack. In addition, parsing the execution
* result and convert it to the resp and reply ot the client.
* result and convert it to the resp and reply to the client.
*
* * Run Redis commands from within the Lua code (Including
* parsing the reply and create a Lua object out of it).

View File

@ -2575,7 +2575,7 @@ void resetServerStats(void) {
}
/* Make the thread killable at any time, so that kill threads functions
* can work reliably (default cancelability type is PTHREAD_CANCEL_DEFERRED).
* can work reliably (default cancellability type is PTHREAD_CANCEL_DEFERRED).
* Needed for pthread_cancel used by the fast memory test used by the crash report. */
void makeThreadKillable(void) {
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@ -6580,7 +6580,7 @@ void dismissClientMemory(client *c) {
/* In the child process, we don't need some buffers anymore, and these are
* likely to change in the parent when there's heavy write traffic.
* We dismiss them right away, to avoid CoW.
* see dismissMemeory(). */
* see dismissMemory(). */
void dismissMemoryInChild(void) {
/* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */
if (server.thp_enabled) return;

View File

@ -1989,7 +1989,7 @@ struct redisServer {
xor of NOTIFY_... flags. */
kvstore *pubsubshard_channels; /* Map shard channels in every slot to list of subscribed clients */
unsigned int pubsub_clients; /* # of clients in Pub/Sub mode */
unsigned int watching_clients; /* # of clients are wathcing keys */
unsigned int watching_clients; /* # of clients are watching keys */
/* Cluster */
int cluster_enabled; /* Is cluster enabled? */
int cluster_port; /* Set the cluster port for a node. */
@ -3432,7 +3432,7 @@ void blockForAofFsync(client *c, mstime_t timeout, long long offset, int numloca
void signalDeletedKeyAsReady(redisDb *db, robj *key, int type);
void updateStatsOnUnblock(client *c, long blocked_us, long reply_us, int had_errors);
void scanDatabaseForDeletedKeys(redisDb *emptied, redisDb *replaced_with);
void totalNumberOfStatefulKeys(unsigned long *blocking_keys, unsigned long *bloking_keys_on_nokey, unsigned long *watched_keys);
void totalNumberOfStatefulKeys(unsigned long *blocking_keys, unsigned long *blocking_keys_on_nokey, unsigned long *watched_keys);
void blockedBeforeSleep(void);
/* timeout.c -- Blocked clients timeout and connections timeout. */

View File

@ -1631,7 +1631,7 @@ static void test_reclaimFilePageCache(void) {
assert(!cache_exist(fd));
unlink(tmpfile);
printf("reclaimFilePageCach test is ok\n");
printf("reclaimFilePageCache test is ok\n");
}
#endif

View File

@ -36,7 +36,7 @@
# Two-word command with multiple non-token block args: CONFIG SET parameter value [parameter value ...]
"CONFIG SET param " "value [parameter value ...]"
"CONFIG SET param val " "[parameter value ...]"
"CONFIG SET param val parm2 val2 " "[parameter value ...]"
"CONFIG SET param val param2 val2 " "[parameter value ...]"
# Command with nested optional args: ZRANDMEMBER key [count [WITHSCORES]]
"ZRANDMEMBER k " "[count [WITHSCORES]]"

View File

@ -387,7 +387,7 @@ start_server {} {
# make sure a write command fails
assert_error {MISCONF *} {r set x y}
# repeate with script
# repeat with script
assert_error {MISCONF *} {r eval {
return redis.call('set','x',1)
} 1 x

View File

@ -11,11 +11,11 @@
#define UNUSED(V) ((void) V)
int child_pid = -1;
int exitted_with_code = -1;
int exited_with_code = -1;
void done_handler(int exitcode, int bysignal, void *user_data) {
child_pid = -1;
exitted_with_code = exitcode;
exited_with_code = exitcode;
assert(user_data==(void*)0xdeadbeef);
UNUSED(bysignal);
}
@ -36,7 +36,7 @@ int fork_create(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
RedisModule_StringToLongLong(argv[1], &code_to_exit_with);
RedisModule_StringToLongLong(argv[2], &usleep_us);
exitted_with_code = -1;
exited_with_code = -1;
int fork_child_pid = RedisModule_Fork(done_handler, (void*)0xdeadbeef);
if (fork_child_pid < 0) {
RedisModule_ReplyWithError(ctx, "Fork failed");
@ -61,7 +61,7 @@ int fork_exitcode(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
UNUSED(argv);
UNUSED(argc);
RedisModule_ReplyWithLongLong(ctx, exitted_with_code);
RedisModule_ReplyWithLongLong(ctx, exited_with_code);
return REDISMODULE_OK;
}

View File

@ -20,7 +20,7 @@ namespace eval response_transformers {}
# Transform a map response into an array of tuples (tuple = array with 2 elements)
# Used for XREAD[GROUP]
proc transfrom_map_to_tupple_array {argv response} {
proc transform_map_to_tuple_array {argv response} {
set tuparray {}
foreach {key val} $response {
set tmp {}
@ -32,7 +32,7 @@ proc transfrom_map_to_tupple_array {argv response} {
}
# Transform an array of tuples to a flat array
proc transfrom_tuple_array_to_flat_array {argv response} {
proc transform_tuple_array_to_flat_array {argv response} {
set flatarray {}
foreach pair $response {
lappend flatarray {*}$pair
@ -42,10 +42,10 @@ proc transfrom_tuple_array_to_flat_array {argv response} {
# With HRANDFIELD, we only need to transform the response if the request had WITHVALUES
# (otherwise the returned response is a flat array in both RESPs)
proc transfrom_hrandfield_command {argv response} {
proc transform_hrandfield_command {argv response} {
foreach ele $argv {
if {[string compare -nocase $ele "WITHVALUES"] == 0} {
return [transfrom_tuple_array_to_flat_array $argv $response]
return [transform_tuple_array_to_flat_array $argv $response]
}
}
return $response
@ -53,10 +53,10 @@ proc transfrom_hrandfield_command {argv response} {
# With some zset commands, we only need to transform the response if the request had WITHSCORES
# (otherwise the returned response is a flat array in both RESPs)
proc transfrom_zset_withscores_command {argv response} {
proc transform_zset_withscores_command {argv response} {
foreach ele $argv {
if {[string compare -nocase $ele "WITHSCORES"] == 0} {
return [transfrom_tuple_array_to_flat_array $argv $response]
return [transform_tuple_array_to_flat_array $argv $response]
}
}
return $response
@ -64,29 +64,29 @@ proc transfrom_zset_withscores_command {argv response} {
# With ZPOPMIN/ZPOPMAX, we only need to transform the response if the request had COUNT (3rd arg)
# (otherwise the returned response is a flat array in both RESPs)
proc transfrom_zpopmin_zpopmax {argv response} {
proc transform_zpopmin_zpopmax {argv response} {
if {[llength $argv] == 3} {
return [transfrom_tuple_array_to_flat_array $argv $response]
return [transform_tuple_array_to_flat_array $argv $response]
}
return $response
}
set ::trasformer_funcs {
XREAD transfrom_map_to_tupple_array
XREADGROUP transfrom_map_to_tupple_array
HRANDFIELD transfrom_hrandfield_command
ZRANDMEMBER transfrom_zset_withscores_command
ZRANGE transfrom_zset_withscores_command
ZRANGEBYSCORE transfrom_zset_withscores_command
ZRANGEBYLEX transfrom_zset_withscores_command
ZREVRANGE transfrom_zset_withscores_command
ZREVRANGEBYSCORE transfrom_zset_withscores_command
ZREVRANGEBYLEX transfrom_zset_withscores_command
ZUNION transfrom_zset_withscores_command
ZDIFF transfrom_zset_withscores_command
ZINTER transfrom_zset_withscores_command
ZPOPMIN transfrom_zpopmin_zpopmax
ZPOPMAX transfrom_zpopmin_zpopmax
set ::transformer_funcs {
XREAD transform_map_to_tuple_array
XREADGROUP transform_map_to_tuple_array
HRANDFIELD transform_hrandfield_command
ZRANDMEMBER transform_zset_withscores_command
ZRANGE transform_zset_withscores_command
ZRANGEBYSCORE transform_zset_withscores_command
ZRANGEBYLEX transform_zset_withscores_command
ZREVRANGE transform_zset_withscores_command
ZREVRANGEBYSCORE transform_zset_withscores_command
ZREVRANGEBYLEX transform_zset_withscores_command
ZUNION transform_zset_withscores_command
ZDIFF transform_zset_withscores_command
ZINTER transform_zset_withscores_command
ZPOPMIN transform_zpopmin_zpopmax
ZPOPMAX transform_zpopmin_zpopmax
}
proc ::response_transformers::transform_response_if_needed {id argv response} {
@ -95,11 +95,11 @@ proc ::response_transformers::transform_response_if_needed {id argv response} {
}
set key [string toupper [lindex $argv 0]]
if {![dict exists $::trasformer_funcs $key]} {
if {![dict exists $::transformer_funcs $key]} {
return $response
}
set transform [dict get $::trasformer_funcs $key]
set transform [dict get $::transformer_funcs $key]
return [$transform $argv $response]
}

View File

@ -666,16 +666,16 @@ start_server {tags {"acl external:skip"}} {
for {set j 0} {$j < 10} {incr j} {
assert_error "*WRONGPASS*" {r AUTH user1 doo}
}
set entry_id_lastest_error [dict get [lindex [r ACL LOG] 0] entry-id]
set entry_id_latest_error [dict get [lindex [r ACL LOG] 0] entry-id]
set timestamp_created_updated [dict get [lindex [r ACL LOG] 0] timestamp-created]
set timestamp_last_updated_after_update [dict get [lindex [r ACL LOG] 0] timestamp-last-updated]
assert {$entry_id_lastest_error eq $entry_id_initial_error}
assert {$entry_id_latest_error eq $entry_id_initial_error}
assert {$timestamp_last_update_original < $timestamp_last_updated_after_update}
assert {$timestamp_created_original eq $timestamp_created_updated}
r ACL setuser user2 >doo
assert_error "*WRONGPASS*" {r AUTH user2 foo}
set new_error_entry_id [dict get [lindex [r ACL LOG] 0] entry-id]
assert {$new_error_entry_id eq $entry_id_lastest_error + 1 }
assert {$new_error_entry_id eq $entry_id_latest_error + 1 }
}
test {ACL LOG shows failed command executions at toplevel} {

View File

@ -466,7 +466,7 @@ start_server {overrides {save {900 1}} tags {"modules"}} {
# rm_call in script mode
assert_error {MISCONF *} {r test.rm_call_flags S set x 1}
# repeate with script
# repeat with script
assert_error {MISCONF *} {r test.rm_call eval {
return redis.call('set','x',1)
} 1 x

View File

@ -553,7 +553,7 @@ start_server {tags {"multi"}} {
catch { $r2 exec; } e
assert_match {EXECABORT*previous errors*} $e
set xx [r get xx]
# make sure that either the whole transcation passed or none of it (we actually expect none)
# make sure that either the whole transaction passed or none of it (we actually expect none)
assert { $xx == 1 || $xx == 3}
# check that the connection is no longer in multi state
set pong [$r2 ping asdf]
@ -578,7 +578,7 @@ start_server {tags {"multi"}} {
r script kill
after 200 ; # Give some time to Lua to call the hook again...
set xx [r get xx]
# make sure that either the whole transcation passed or none of it (we actually expect none)
# make sure that either the whole transaction passed or none of it (we actually expect none)
assert { $xx == 1 || $xx == 3}
# check that the connection is no longer in multi state
set pong [$r2 ping asdf]
@ -603,7 +603,7 @@ start_server {tags {"multi"}} {
catch { $r2 exec; } e
assert_match {EXECABORT*previous errors*} $e
set xx [r get xx]
# make sure that either the whole transcation passed or none of it (we actually expect none)
# make sure that either the whole transaction passed or none of it (we actually expect none)
assert { $xx == 1 || $xx == 3}
# check that the connection is no longer in multi state
set pong [$r2 ping asdf]

View File

@ -1051,7 +1051,7 @@ start_server {
set n_consumers [lindex $grpinfo 3]
# All consumers are created via XREADGROUP, regardless of whether they managed
# to read any entries ot not
# to read any entries or not
assert_equal $n_consumers 3
$rd close
}

View File

@ -289,7 +289,7 @@ start_server {tags {"zset"}} {
assert {[r zscore ztmp x] == 25}
}
test "ZADD INCR works with a single score-elemenet pair - $encoding" {
test "ZADD INCR works with a single score-element pair - $encoding" {
r del ztmp
r zadd ztmp 10 x 20 y 30 z
catch {r zadd ztmp INCR 15 x 10 y} err