diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32121a70..3014bc04 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,10 +37,15 @@ repos: - id: markdownlint-fix exclude: LICENSE.md - - repo: https://github.com/crate-ci/typos - rev: v1.31.2 + - repo: https://github.com/codespell-project/codespell + rev: v2.4.1 hooks: - - id: typos + - id: codespell + args: + [ + --write-changes, + --ignore-words=pre-commit-hooks/codespell_ignore.txt, + ] # Running fix-local-includes before clang-format # to ensure that the include order is correct. diff --git a/_typos.toml b/_typos.toml deleted file mode 100644 index 2341e670..00000000 --- a/_typos.toml +++ /dev/null @@ -1,22 +0,0 @@ -[default] -# This allows to ignore account ids in tests and private keys -# More info: https://github.com/crate-ci/typos/issues/415 -extend-ignore-re = [ - "[a-z-A-Z0-9]{33}", - "[a-z-A-Z0-9]{34}", - "[a-z-A-Z0-9]{64}", -] - -[default.extend-identifiers] -# (S)tring -tring = "tring" -trings = "trings" - -ASSERTs = "ASSERTs" -EXCLUDEs = "EXCLUDEs" - -ser = "ser" - -[default.extend-words] -strat = "strat" -datas = "datas" diff --git a/cmake/Settings.cmake b/cmake/Settings.cmake index 508a111c..85fe7df9 100644 --- a/cmake/Settings.cmake +++ b/cmake/Settings.cmake @@ -26,7 +26,7 @@ set(COMPILER_FLAGS # TODO: Address these and others in https://github.com/XRPLF/clio/issues/1273 ) -# TODO: reenable when we change CI #884 if (is_gcc AND NOT lint) list(APPEND COMPILER_FLAGS -Wduplicated-branches +# TODO: re-enable when we change CI #884 if (is_gcc AND NOT lint) list(APPEND COMPILER_FLAGS -Wduplicated-branches # -Wduplicated-cond -Wlogical-op -Wuseless-cast ) endif () if (is_clang) diff --git a/pre-commit-hooks/codespell_ignore.txt b/pre-commit-hooks/codespell_ignore.txt new file mode 100644 index 00000000..80e07e8b --- /dev/null +++ b/pre-commit-hooks/codespell_ignore.txt @@ -0,0 +1,9 @@ +ser +onWs +datas +AtLeast +AtMost +compiletime +tring +trings +strat diff --git a/src/rpc/handlers/Subscribe.cpp b/src/rpc/handlers/Subscribe.cpp index 2f140d9f..6a302aca 100644 --- a/src/rpc/handlers/Subscribe.cpp +++ b/src/rpc/handlers/Subscribe.cpp @@ -214,7 +214,7 @@ SubscribeHandler::subscribeToBooks( auto const [offers, _] = sharedPtrBackend_->fetchBookOffers(bookBase, rng->maxSequence, kFETCH_LIMIT, yield); - // the taker is not really uesed, same issue with + // the taker is not really used, same issue with // https://github.com/XRPLF/xrpl-dev-portal/issues/1818 auto const takerID = internalBook.taker ? accountFromStringStrict(*(internalBook.taker)) : beast::zero; diff --git a/src/util/Taggable.hpp b/src/util/Taggable.hpp index f2265d94..aa89a165 100644 --- a/src/util/Taggable.hpp +++ b/src/util/Taggable.hpp @@ -159,7 +159,7 @@ public: /** * @brief Specialization for a nop/null decorator. * - * This generates a pass-thru decorate member function which can be optimized away by the compiler. + * This generates a pass-through decorate member function which can be optimized away by the compiler. */ template <> class TagDecorator final : public BaseTagDecorator { diff --git a/src/util/async/README.md b/src/util/async/README.md index d6380f20..13c86fdd 100644 --- a/src/util/async/README.md +++ b/src/util/async/README.md @@ -32,7 +32,7 @@ There are multiple execution contexts to choose from, each with their own pros a This context wraps a thread pool and executes blocks of code by means of `boost::asio::spawn` which spawns coroutines. -Deep inside the framework it hides `boost::asio::yield_context` and automatically switches coroutine contexts everytime user’s code is checking `isStopRequested()` on the `StopToken` given to the user-provided lambda. +Deep inside the framework it hides `boost::asio::yield_context` and automatically switches coroutine contexts every time user’s code is checking `isStopRequested()` on the `StopToken` given to the user-provided lambda. The benefit is that both timers and async operations can work concurrently on a `CoroExecutionContext` even if internally the thread pool only has 1 thread. diff --git a/src/web/Server.hpp b/src/web/Server.hpp index e646ab6e..b480b322 100644 --- a/src/web/Server.hpp +++ b/src/web/Server.hpp @@ -120,7 +120,7 @@ public: } /** - * @brief A helper function that is called when any error ocurs. + * @brief A helper function that is called when any error occurs. * * @param ec The error code * @param message The message to include in the log diff --git a/src/web/impl/WsBase.hpp b/src/web/impl/WsBase.hpp index 195ead02..6651e4f9 100644 --- a/src/web/impl/WsBase.hpp +++ b/src/web/impl/WsBase.hpp @@ -236,7 +236,7 @@ public: } /** - * @brief Accept the session asynchroniously + * @brief Accept the session asynchronously */ void run(http::request req) diff --git a/tests/unit/rpc/handlers/LedgerTests.cpp b/tests/unit/rpc/handlers/LedgerTests.cpp index 50956efc..9c2a0cf2 100644 --- a/tests/unit/rpc/handlers/LedgerTests.cpp +++ b/tests/unit/rpc/handlers/LedgerTests.cpp @@ -292,7 +292,7 @@ TEST_F(RPCLedgerHandlerTest, Default) auto const req = json::parse("{}"); auto output = handler.process(req, Context{yield}); ASSERT_TRUE(output); - // remove human readable time, it is sightly different cross the platform + // remove human readable time, it is slightly different cross the platform EXPECT_EQ(output.result->as_object().at("ledger").as_object().erase("close_time_human"), 1); EXPECT_EQ(*output.result, json::parse(kEXPECTED_OUT)); }); @@ -562,7 +562,7 @@ TEST_F(RPCLedgerHandlerTest, TransactionsExpandNotBinary) ); auto output = handler.process(req, Context{yield}); ASSERT_TRUE(output); - // remove human readable time, it is sightly different cross the platform + // remove human readable time, it is slightly different cross the platform EXPECT_EQ(output.result->as_object().at("ledger").as_object().erase("close_time_human"), 1); EXPECT_EQ(*output.result, json::parse(kEXPECTED_OUT)); }); @@ -660,7 +660,7 @@ TEST_F(RPCLedgerHandlerTest, TransactionsExpandNotBinaryV2) ); auto output = handler.process(req, Context{.yield = yield, .apiVersion = 2u}); ASSERT_TRUE(output); - // remove human readable time, it is sightly different cross the platform + // remove human readable time, it is slightly different cross the platform EXPECT_EQ(output.result->as_object().at("ledger").as_object().erase("close_time_human"), 1); EXPECT_EQ(*output.result, json::parse(kEXPECTED_OUT)); }); @@ -923,7 +923,7 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsEmpty) ); auto output = handler.process(req, Context{yield}); ASSERT_TRUE(output); - // remove human readable time, it is sightly different cross the platform + // remove human readable time, it is slightly different cross the platform EXPECT_EQ(output.result->as_object().at("ledger").as_object().erase("close_time_human"), 1); EXPECT_EQ(*output.result, json::parse(kEXPECTED_OUT)); }); @@ -1031,7 +1031,7 @@ TEST_F(RPCLedgerHandlerTest, OwnerFundsTrueBinaryFalse) ); auto output = handler.process(req, Context{yield}); ASSERT_TRUE(output); - // remove human readable time, it is sightly different cross the platform + // remove human readable time, it is slightly different cross the platform EXPECT_EQ(output.result->as_object().at("ledger").as_object().erase("close_time_human"), 1); EXPECT_EQ(*output.result, json::parse(kEXPECTED_OUT)); });