Skip to content
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

Add a spell check ci that will fail future PRs #1660

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .codespell/.codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move these files to .github/config.

quiet-level = 2
skip = ./tests/gocase/util/slot.go
ignore-words = ./.codespell/wordlist.txt
1 change: 1 addition & 0 deletions .codespell/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
codespell==2.2.5
3 changes: 3 additions & 0 deletions .codespell/wordlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exat
smove
ue
50 changes: 50 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# A CI action that using codespell to check spell.
# .codespell/.codespellrc is a config file.
# .codespell/wordlist.txt is a list of words that will ignore word checks.
# More details please check the following link:
# https://github.com/codespell-project/codespell

name: Spellcheck

on:
push:
pull_request:

jobs:
build:
name: Spellcheck
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: pip cache
uses: actions/cache@v3
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

- name: Spell check
run: codespell --config=./.codespell/.codespellrc
2 changes: 1 addition & 1 deletion kvrocks.conf
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ rocksdb.write_options.sync no
# If yes, writes will not first go to the write ahead log,
# and the write may get lost after a crash.
#
# Deafult: no
# Default: no
rocksdb.write_options.disable_wal no

# If enabled and we need to wait or sleep for the write request, fails
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/slot_import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void SlotImport::StopForLinkError(int fd) {
// 2. Source server's migration process end after destination server has finished replication.
// 3. The migration link closed by source server, then this function will be call by OnEvent.
// 4. ClearKeysOfSlot can clear data although server is a slave, because ClearKeysOfSlot
// deletes data in rocksdb directly. Therefor, it is necessary to avoid clearing data gotten
// deletes data in rocksdb directly. Therefore, it is necessary to avoid clearing data gotten
// from new master.
if (!svr_->IsSlave()) {
// Clean imported slot data
Expand Down
2 changes: 1 addition & 1 deletion src/cluster/slot_migrate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ Status SlotMigrator::sendSnapshot() {
}

LOG(INFO) << "[migrate] Succeed to migrate slot snapshot, slot: " << slot << ", Migrated keys: " << migrated_key_cnt
<< ", Expired keys: " << expired_key_cnt << ", Emtpy keys: " << empty_key_cnt;
<< ", Expired keys: " << expired_key_cnt << ", Empty keys: " << empty_key_cnt;

return Status::OK();
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cmd_cluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CommandCluster : public Commander {
}

if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

if (subcommand_ == "keyslot") {
Expand Down Expand Up @@ -216,7 +216,7 @@ class CommandClusterX : public Commander {
}

if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

bool need_persist_nodes_info = false;
Expand Down
14 changes: 7 additions & 7 deletions src/commands/cmd_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class CommandNamespace : public Commander {
public:
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

Config *config = svr->GetConfig();
Expand Down Expand Up @@ -173,7 +173,7 @@ class CommandFlushAll : public Commander {
public:
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

if (svr->GetConfig()->cluster_enabled) {
Expand Down Expand Up @@ -221,7 +221,7 @@ class CommandConfig : public Commander {
public:
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

Config *config = svr->GetConfig();
Expand Down Expand Up @@ -547,7 +547,7 @@ class CommandShutdown : public Commander {
public:
Status Execute(Server *srv, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

if (!srv->IsStopped()) {
Expand Down Expand Up @@ -842,7 +842,7 @@ class CommandBGSave : public Commander {
public:
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

Status s = svr->AsyncBgSaveDB();
Expand All @@ -858,7 +858,7 @@ class CommandFlushBackup : public Commander {
public:
Status Execute(Server *svr, Connection *conn, std::string *output) override {
if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

Status s = svr->AsyncPurgeOldBackups(0, 0);
Expand Down Expand Up @@ -917,7 +917,7 @@ class CommandSlaveOf : public Commander {
}

if (!conn->IsAdmin()) {
return {Status::RedisExecErr, errAdministorPermissionRequired};
return {Status::RedisExecErr, errAdministratorPermissionRequired};
}

if (host_.empty()) {
Expand Down
3 changes: 2 additions & 1 deletion src/commands/error_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ inline constexpr const char *errInvalidSyntax = "syntax error";
inline constexpr const char *errInvalidExpireTime = "invalid expire time";
inline constexpr const char *errWrongNumOfArguments = "wrong number of arguments";
inline constexpr const char *errValueNotInteger = "value is not an integer or out of range";
inline constexpr const char *errAdministorPermissionRequired = "administor permission required to perform the command";
inline constexpr const char *errAdministratorPermissionRequired =
"administrator permission required to perform the command";
inline constexpr const char *errValueMustBePositive = "value is out of range, must be positive";
inline constexpr const char *errNoSuchKey = "no such key";
inline constexpr const char *errUnbalancedStreamList =
Expand Down
4 changes: 2 additions & 2 deletions src/types/geohash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ uint8_t GeoHashHelper::EstimateStepsByRadius(double range_meters, double lat) {
}
step -= 2; /* Make sure range is included in most of the base cases. */

/* Wider range torwards the poles... Note: it is possible to do better
/* Wider range towards the poles... Note: it is possible to do better
* than this approximation by computing the distance between meridians
* at this latitude, but this does the trick for now. */
if (lat > 66 || lat < -66) {
Expand All @@ -328,7 +328,7 @@ uint8_t GeoHashHelper::EstimateStepsByRadius(double range_meters, double lat) {

/* Return the bounding box of the search area centered at latitude,longitude
* having a radius of radius_meter. bounds[0] - bounds[2] is the minimum
* and maxium longitude, while bounds[1] - bounds[3] is the minimum and
* and maximum longitude, while bounds[1] - bounds[3] is the minimum and
* maximum latitude. */
int GeoHashHelper::BoundingBox(GeoShape *geo_shape) {
if (!geo_shape->bounds) return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/types/redis_geo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void Geo::scoresOfGeoHashBox(GeoHashBits hash, GeoHashFix52Bits *min, GeoHashFix
* 'max', appending them into the array of GeoPoint structures 'gparray'.
* The command returns the number of elements added to the array.
*
* Elements which are farest than 'radius' from the specified 'x' and 'y'
* Elements which are farther than 'radius' from the specified 'x' and 'y'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Elements which are farther than 'radius' from the specified 'x' and 'y'
* Elements which are farthest than 'radius' from the specified 'x' and 'y'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since there is a than, i think it should be farther? (although i am not sure about it)

* coordinates are not included.
*
* The ability of this function to append to an existing set of points is
Expand Down
2 changes: 1 addition & 1 deletion tests/cppunit/types/hash_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ TEST_F(RedisHashTest, HRangeByLex) {
EXPECT_EQ("key1", result[0].field);
EXPECT_EQ("key2", result[1].field);

// inf and revered
// inf and reversed
spec.minex = false;
spec.maxex = false;
spec.min = "-";
Expand Down
2 changes: 1 addition & 1 deletion tests/gocase/unit/multi/multi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestMulti(t *testing.T) {
rdb := srv.NewClient()
defer func() { require.NoError(t, rdb.Close()) }()

t.Run("MUTLI / EXEC basics", func(t *testing.T) {
t.Run("MULTI / EXEC basics", func(t *testing.T) {
require.NoError(t, rdb.Del(ctx, "mylist").Err())
require.NoError(t, rdb.RPush(ctx, "mylist", "a").Err())
require.NoError(t, rdb.RPush(ctx, "mylist", "b").Err())
Expand Down