Skip to content

style: Add typos pre-commit hook #2041

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

Merged
merged 7 commits into from
Apr 29, 2025
Merged
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: 2 additions & 2 deletions .cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ format:
_help_require_valid_layout:
- By default, if cmake-format cannot successfully fit
- everything into the desired linewidth it will apply the
- last, most agressive attempt that it made. If this flag is
- last, most aggressive attempt that it made. If this flag is
- True, however, cmake-format will print error, exit with non-
- zero status code, and write-out nothing
require_valid_layout: false
Expand Down Expand Up @@ -152,7 +152,7 @@ markup:
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
_help_explicit_trailing_pattern:
- If a comment line matches starts with this pattern then it
- is explicitly a trailing comment for the preceeding
- is explicitly a trailing comment for the preceding
- argument. Default is '#<'
explicit_trailing_pattern: "#<"
_help_hashruler_min_length:
Expand Down
2 changes: 1 addition & 1 deletion .githooks/check-docs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Note: This script is intended to be run from the root of the repository.
#
# Not really a hook but should be used to check the completness of documentation for added code, otherwise CI will come for you.
# Not really a hook but should be used to check the completeness of documentation for added code, otherwise CI will come for you.
# It's good to have /tmp as the output so that consecutive runs are fast but no clutter in the repository.

echo "+ Checking documentation..."
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/build_clio/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
target:
description: Build target name
default: all
substract_threads:
subtract_threads:
description: An option for the action get_number_of_threads. See get_number_of_threads
required: true
default: "0"
Expand All @@ -15,7 +15,7 @@ runs:
uses: ./.github/actions/get_number_of_threads
id: number_of_threads
with:
substract_threads: ${{ inputs.substract_threads }}
subtract_threads: ${{ inputs.subtract_threads }}

- name: Build Clio
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/get_number_of_threads/action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Get number of threads
description: Determines number of threads to use on macOS and Linux
inputs:
substract_threads:
description: How many threads to substract from the calculated number
subtract_threads:
description: How many threads to subtract from the calculated number
required: true
default: "0"
outputs:
Expand All @@ -29,6 +29,6 @@ runs:
shell: bash
run: |
num_of_threads=${{ steps.mac_threads.outputs.num || steps.linux_threads.outputs.num }}
shift_by=${{ inputs.substract_threads }}
shift_by=${{ inputs.subtract_threads }}
shifted=$((num_of_threads - shift_by))
echo "num=$(( shifted > 1 ? shifted : 1 ))" >> $GITHUB_OUTPUT
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ repos:
hooks:
- id: markdownlint-fix
exclude: LICENSE.md

- repo: https://github.com/crate-ci/typos
rev: v1.31.2
hooks:
- id: typos
22 changes: 22 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[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"
2 changes: 1 addition & 1 deletion docs/examples/infrastructure/grafana/clio_dashboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@
"refId": "B"
}
],
"title": "DB Opperations Error Rate",
"title": "DB Operations Error Rate",
"type": "timeseries"
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/trouble_shooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ If you see the error log message `Failed to fetch ETL state from...`, this means
- Make sure the rippled node is running at the specified address and port.
- Make sure the rippled node is accessible from the machine where Clio is running.

If you would like to run Clio without an avaliable rippled node, you can add below setting to Clio's configuration file:
If you would like to run Clio without an available rippled node, you can add below setting to Clio's configuration file:

```text
"allow_no_etl": true
Expand All @@ -53,7 +53,7 @@ curl -v -d '{"method":"server_info", "params":[{}]}' 127.0.0.1:51233|python3 -m
curl -v -d '{"method":"server_info", "params":[{}]}' 127.0.0.1:51233|python3 -m json.tool|grep is_enabled
```

If `is_full` is false, it means the cache is still loading. Normally, the Clio can respond quicker if cache finishs loading. If `is_enabled` is false, it means the cache is disabled in the configuration file or there is data corruption in the database.
If `is_full` is false, it means the cache is still loading. Normally, the Clio can respond quicker if cache finishes loading. If `is_enabled` is false, it means the cache is disabled in the configuration file or there is data corruption in the database.

## Receive error message `Too many requests`

Expand Down
2 changes: 1 addition & 1 deletion src/cluster/ClusterCommunicationService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ClusterCommunicationService : public ClusterCommunicationServiceInterface
util::prometheus::Bool isHealthy_ = PrometheusService::boolMetric(
"cluster_communication_is_healthy",
{},
"Whether cluster communicaton service is operating healthy (1 - healthy, 0 - we have a problem)"
"Whether cluster communication service is operating healthy (1 - healthy, 0 - we have a problem)"
);

// TODO: Use util::async::CoroExecutionContext after https://github.com/XRPLF/clio/issues/1973 is implemented
Expand Down
4 changes: 2 additions & 2 deletions src/data/BackendInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ BackendInterface::finishWrites(std::uint32_t const ledgerSequence)
LOG(gLog.debug()) << "Want finish writes for " << ledgerSequence;
auto commitRes = doFinishWrites();
if (commitRes) {
LOG(gLog.debug()) << "Successfully commited. Updating range now to " << ledgerSequence;
LOG(gLog.debug()) << "Successfully committed. Updating range now to " << ledgerSequence;
updateRange(ledgerSequence);
}
return commitRes;
Expand Down Expand Up @@ -246,7 +246,7 @@ BackendInterface::fetchBookOffers(
auto end = std::chrono::system_clock::now();
LOG(gLog.debug()) << "Fetching " << std::to_string(keys.size()) << " offers took "
<< std::to_string(getMillis(mid - begin)) << " milliseconds. Fetching next dir took "
<< std::to_string(succMillis) << " milliseonds. Fetched next dir " << std::to_string(numSucc)
<< std::to_string(succMillis) << " milliseconds. Fetched next dir " << std::to_string(numSucc)
<< " times"
<< " Fetching next page of dir took " << std::to_string(pageMillis) << " milliseconds"
<< ". num pages = " << std::to_string(numPages) << ". Fetching all objects took "
Expand Down
10 changes: 5 additions & 5 deletions src/data/BackendInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DatabaseTimeout : public std::exception {

static constexpr std::size_t kDEFAULT_WAIT_BETWEEN_RETRY = 500;
/**
* @brief A helper function that catches DatabaseTimout exceptions and retries indefinitely.
* @brief A helper function that catches DatabaseTimeout exceptions and retries indefinitely.
*
* @tparam FnType The type of function object to execute
* @param func The function object to execute
Expand Down Expand Up @@ -398,7 +398,7 @@ class BackendInterface {
* @brief Fetches a specific ledger object.
*
* Currently the real fetch happens in doFetchLedgerObject and fetchLedgerObject attempts to fetch from Cache first
* and only calls out to the real DB if a cache miss ocurred.
* and only calls out to the real DB if a cache miss occurred.
*
* @param key The key of the object
* @param sequence The ledger sequence to fetch for
Expand Down Expand Up @@ -512,7 +512,7 @@ class BackendInterface {
* @param key The key to fetch for
* @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context
* @return The sucessor on success; nullopt otherwise
* @return The successor on success; nullopt otherwise
*/
std::optional<LedgerObject>
fetchSuccessorObject(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
Expand All @@ -526,7 +526,7 @@ class BackendInterface {
* @param key The key to fetch for
* @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context
* @return The sucessor key on success; nullopt otherwise
* @return The successor key on success; nullopt otherwise
*/
std::optional<ripple::uint256>
fetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
Expand All @@ -537,7 +537,7 @@ class BackendInterface {
* @param key The key to fetch for
* @param ledgerSequence The ledger sequence to fetch for
* @param yield The coroutine context
* @return The sucessor on success; nullopt otherwise
* @return The successor on success; nullopt otherwise
*/
virtual std::optional<ripple::uint256>
doFetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/data/CassandraBackend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ class BasicCassandraBackend : public BackendInterface {

while (liveAccounts.size() < number) {
Statement const statement = lastItem ? schema_->selectAccountFromToken.bind(*lastItem, Limit{pageSize})
: schema_->selectAccountFromBegining.bind(Limit{pageSize});
: schema_->selectAccountFromBeginning.bind(Limit{pageSize});

auto const res = executor_.read(yield, statement);
if (res) {
Expand Down
2 changes: 1 addition & 1 deletion src/data/LedgerCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LedgerCache::update(std::vector<LedgerObject> const& objs, uint32_t seq, bool is
if (seq > latestSeq_) {
ASSERT(
seq == latestSeq_ + 1 || latestSeq_ == 0,
"New sequense must be either next or first. seq = {}, latestSeq_ = {}",
"New sequence must be either next or first. seq = {}, latestSeq_ = {}",
seq,
latestSeq_
);
Expand Down
2 changes: 1 addition & 1 deletion src/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ This table stores the list of transactions affecting a given account. This inclu
```sql
CREATE TABLE clio.successor (
key blob, # Object index
seq bigint, # The sequnce that this ledger object's predecessor and successor was updated
seq bigint, # The sequence that this ledger object's predecessor and successor was updated
next blob, # Index of the next object that existed in this sequence
PRIMARY KEY (key, seq)
) WITH CLUSTERING ORDER BY (seq ASC) ...
Expand Down
18 changes: 9 additions & 9 deletions src/data/cassandra/Handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Handle {
asyncConnect() const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncConnect() const for how this works.
*
Expand All @@ -108,7 +108,7 @@ class Handle {
asyncConnect(std::string_view keyspace) const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncConnect(std::string_view) const for how this works.
*
Expand All @@ -127,7 +127,7 @@ class Handle {
asyncDisconnect() const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncDisconnect() const for how this works.
*
Expand All @@ -146,7 +146,7 @@ class Handle {
asyncReconnect(std::string_view keyspace) const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncReconnect(std::string_view) const for how this works.
*
Expand All @@ -172,7 +172,7 @@ class Handle {
}

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See asyncExecute(std::string_view, Args&&...) const for how this works.
*
Expand Down Expand Up @@ -201,7 +201,7 @@ class Handle {
asyncExecuteEach(std::vector<StatementType> const& statements) const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncExecuteEach(std::vector<StatementType> const&) const for how this works.
*
Expand All @@ -227,7 +227,7 @@ class Handle {
}

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See asyncExecute(std::vector<StatementType> const&, Args&&...) const for how this works.
*
Expand Down Expand Up @@ -262,7 +262,7 @@ class Handle {
asyncExecute(StatementType const& statement, std::function<void(ResultOrErrorType)>&& cb) const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncExecute(StatementType const&) const for how this works.
*
Expand All @@ -282,7 +282,7 @@ class Handle {
asyncExecute(std::vector<StatementType> const& statements) const;

/**
* @brief Synchonous version of the above.
* @brief Synchronous version of the above.
*
* See @ref asyncExecute(std::vector<StatementType> const&) const for how this works.
*
Expand Down
2 changes: 1 addition & 1 deletion src/data/cassandra/Schema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ class Schema {
));
}();

PreparedStatement selectAccountFromBegining = [this]() {
PreparedStatement selectAccountFromBeginning = [this]() {
return handle_.get().prepare(fmt::format(
R"(
SELECT account
Expand Down
2 changes: 1 addition & 1 deletion src/data/cassandra/impl/AsyncExecutor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
namespace data::cassandra::impl {

/**
* @brief A query executor with a changable retry policy
* @brief A query executor with a changeable retry policy
*
* Note: this is a bit of an anti-pattern and should be done differently
* eventually.
Expand Down
2 changes: 1 addition & 1 deletion src/data/cassandra/impl/ExecutionStrategy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ class DefaultExecutionStrategy {
}

/**
* @brief Non-blocking query execution used for writing data. Constrast with write, this method does not execute
* @brief Non-blocking query execution used for writing data. Contrast with write, this method does not execute
* the statements in a batch.
*
* Retries forever with retry policy specified by @ref AsyncExecutor.
Expand Down
2 changes: 1 addition & 1 deletion src/etl/ETLHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class ThreadSafeQueue {
};

/**
* @brief Parititions the uint256 keyspace into numMarkers partitions, each of equal size.
* @brief Partitions the uint256 keyspace into numMarkers partitions, each of equal size.
*
* @param numMarkers Total markers to partition for
* @return The markers
Expand Down
2 changes: 1 addition & 1 deletion src/etl/ETLService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ETLService::runETLPipeline(uint32_t startSequence, uint32_t numExtractors)
}

// Main loop of ETL.
// The software begins monitoring the ledgers that are validated by the nework.
// The software begins monitoring the ledgers that are validated by the network.
// The member networkValidatedLedgers_ keeps track of the sequences of ledgers validated by the network.
// Whenever a ledger is validated by the network, the software looks for that ledger in the database. Once the ledger is
// found in the database, the software publishes that ledger to the ledgers stream. If a network validated ledger is not
Expand Down
2 changes: 1 addition & 1 deletion src/etl/ETLService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ class ETLService : public etlng::ETLServiceInterface, ETLServiceTag {
/**
* @brief Get the number of markers to use during the initial ledger download.
*
* This is equivelent to the degree of parallelism during the initial ledger download.
* This is equivalent to the degree of parallelism during the initial ledger download.
*
* @return The number of markers
*/
Expand Down
4 changes: 2 additions & 2 deletions src/etl/LedgerFetcherInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct LedgerFetcherInterface {
/**
* @brief Extract data for a particular ledger from an ETL source
*
* This function continously tries to extract the specified ledger (using all available ETL sources) until the
* This function continuously tries to extract the specified ledger (using all available ETL sources) until the
* extraction succeeds, or the server shuts down.
*
* @param seq sequence of the ledger to extract
Expand All @@ -52,7 +52,7 @@ struct LedgerFetcherInterface {
/**
* @brief Extract diff data for a particular ledger from an ETL source.
*
* This function continously tries to extract the specified ledger (using all available ETL sources) until the
* This function continuously tries to extract the specified ledger (using all available ETL sources) until the
* extraction succeeds, or the server shuts down.
*
* @param seq sequence of the ledger to extract
Expand Down
2 changes: 1 addition & 1 deletion src/etl/impl/ExtractionDataPipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ExtractionDataPipe {
/**
* @brief Push new data package for the specified sequence.
*
* Note: Potentially blocks until the underlying queue can accomodate another entry.
* Note: Potentially blocks until the underlying queue can accommodate another entry.
*
* @param sequence The sequence for which to enqueue the data package
* @param data The data to store
Expand Down
Loading
Loading