Skip to content

Commit af0a8af

Browse files
authored
style: Add typos pre-commit hook (#2041)
1 parent de43be8 commit af0a8af

File tree

95 files changed

+207
-180
lines changed

Some content is hidden

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

95 files changed

+207
-180
lines changed

.cmake-format.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ format:
115115
_help_require_valid_layout:
116116
- By default, if cmake-format cannot successfully fit
117117
- everything into the desired linewidth it will apply the
118-
- last, most agressive attempt that it made. If this flag is
118+
- last, most aggressive attempt that it made. If this flag is
119119
- True, however, cmake-format will print error, exit with non-
120120
- zero status code, and write-out nothing
121121
require_valid_layout: false
@@ -152,7 +152,7 @@ markup:
152152
ruler_pattern: ^\s*[^\w\s]{3}.*[^\w\s]{3}$
153153
_help_explicit_trailing_pattern:
154154
- If a comment line matches starts with this pattern then it
155-
- is explicitly a trailing comment for the preceeding
155+
- is explicitly a trailing comment for the preceding
156156
- argument. Default is '#<'
157157
explicit_trailing_pattern: "#<"
158158
_help_hashruler_min_length:

.githooks/check-docs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

88
echo "+ Checking documentation..."

.github/actions/build_clio/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
target:
55
description: Build target name
66
default: all
7-
substract_threads:
7+
subtract_threads:
88
description: An option for the action get_number_of_threads. See get_number_of_threads
99
required: true
1010
default: "0"
@@ -15,7 +15,7 @@ runs:
1515
uses: ./.github/actions/get_number_of_threads
1616
id: number_of_threads
1717
with:
18-
substract_threads: ${{ inputs.substract_threads }}
18+
subtract_threads: ${{ inputs.subtract_threads }}
1919

2020
- name: Build Clio
2121
shell: bash

.github/actions/get_number_of_threads/action.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Get number of threads
22
description: Determines number of threads to use on macOS and Linux
33
inputs:
4-
substract_threads:
5-
description: How many threads to substract from the calculated number
4+
subtract_threads:
5+
description: How many threads to subtract from the calculated number
66
required: true
77
default: "0"
88
outputs:
@@ -29,6 +29,6 @@ runs:
2929
shell: bash
3030
run: |
3131
num_of_threads=${{ steps.mac_threads.outputs.num || steps.linux_threads.outputs.num }}
32-
shift_by=${{ inputs.substract_threads }}
32+
shift_by=${{ inputs.subtract_threads }}
3333
shifted=$((num_of_threads - shift_by))
3434
echo "num=$(( shifted > 1 ? shifted : 1 ))" >> $GITHUB_OUTPUT

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ repos:
4545
hooks:
4646
- id: markdownlint-fix
4747
exclude: LICENSE.md
48+
49+
- repo: https://github.com/crate-ci/typos
50+
rev: v1.31.2
51+
hooks:
52+
- id: typos

_typos.toml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[default]
2+
# This allows to ignore account ids in tests and private keys
3+
# More info: https://github.com/crate-ci/typos/issues/415
4+
extend-ignore-re = [
5+
"[a-z-A-Z0-9]{33}",
6+
"[a-z-A-Z0-9]{34}",
7+
"[a-z-A-Z0-9]{64}",
8+
]
9+
10+
[default.extend-identifiers]
11+
# (S)tring
12+
tring = "tring"
13+
trings = "trings"
14+
15+
ASSERTs = "ASSERTs"
16+
EXCLUDEs = "EXCLUDEs"
17+
18+
ser = "ser"
19+
20+
[default.extend-words]
21+
strat = "strat"
22+
datas = "datas"

docs/examples/infrastructure/grafana/clio_dashboard.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@
13981398
"refId": "B"
13991399
}
14001400
],
1401-
"title": "DB Opperations Error Rate",
1401+
"title": "DB Operations Error Rate",
14021402
"type": "timeseries"
14031403
},
14041404
{

docs/trouble_shooting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If you see the error log message `Failed to fetch ETL state from...`, this means
3333
- Make sure the rippled node is running at the specified address and port.
3434
- Make sure the rippled node is accessible from the machine where Clio is running.
3535

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

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

56-
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.
56+
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.
5757

5858
## Receive error message `Too many requests`
5959

src/cluster/ClusterCommunicationService.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ClusterCommunicationService : public ClusterCommunicationServiceInterface
5050
util::prometheus::Bool isHealthy_ = PrometheusService::boolMetric(
5151
"cluster_communication_is_healthy",
5252
{},
53-
"Whether cluster communicaton service is operating healthy (1 - healthy, 0 - we have a problem)"
53+
"Whether cluster communication service is operating healthy (1 - healthy, 0 - we have a problem)"
5454
);
5555

5656
// TODO: Use util::async::CoroExecutionContext after https://github.com/XRPLF/clio/issues/1973 is implemented

src/data/BackendInterface.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ BackendInterface::finishWrites(std::uint32_t const ledgerSequence)
6161
LOG(gLog.debug()) << "Want finish writes for " << ledgerSequence;
6262
auto commitRes = doFinishWrites();
6363
if (commitRes) {
64-
LOG(gLog.debug()) << "Successfully commited. Updating range now to " << ledgerSequence;
64+
LOG(gLog.debug()) << "Successfully committed. Updating range now to " << ledgerSequence;
6565
updateRange(ledgerSequence);
6666
}
6767
return commitRes;
@@ -246,7 +246,7 @@ BackendInterface::fetchBookOffers(
246246
auto end = std::chrono::system_clock::now();
247247
LOG(gLog.debug()) << "Fetching " << std::to_string(keys.size()) << " offers took "
248248
<< std::to_string(getMillis(mid - begin)) << " milliseconds. Fetching next dir took "
249-
<< std::to_string(succMillis) << " milliseonds. Fetched next dir " << std::to_string(numSucc)
249+
<< std::to_string(succMillis) << " milliseconds. Fetched next dir " << std::to_string(numSucc)
250250
<< " times"
251251
<< " Fetching next page of dir took " << std::to_string(pageMillis) << " milliseconds"
252252
<< ". num pages = " << std::to_string(numPages) << ". Fetching all objects took "

src/data/BackendInterface.hpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class DatabaseTimeout : public std::exception {
6969

7070
static constexpr std::size_t kDEFAULT_WAIT_BETWEEN_RETRY = 500;
7171
/**
72-
* @brief A helper function that catches DatabaseTimout exceptions and retries indefinitely.
72+
* @brief A helper function that catches DatabaseTimeout exceptions and retries indefinitely.
7373
*
7474
* @tparam FnType The type of function object to execute
7575
* @param func The function object to execute
@@ -398,7 +398,7 @@ class BackendInterface {
398398
* @brief Fetches a specific ledger object.
399399
*
400400
* Currently the real fetch happens in doFetchLedgerObject and fetchLedgerObject attempts to fetch from Cache first
401-
* and only calls out to the real DB if a cache miss ocurred.
401+
* and only calls out to the real DB if a cache miss occurred.
402402
*
403403
* @param key The key of the object
404404
* @param sequence The ledger sequence to fetch for
@@ -512,7 +512,7 @@ class BackendInterface {
512512
* @param key The key to fetch for
513513
* @param ledgerSequence The ledger sequence to fetch for
514514
* @param yield The coroutine context
515-
* @return The sucessor on success; nullopt otherwise
515+
* @return The successor on success; nullopt otherwise
516516
*/
517517
std::optional<LedgerObject>
518518
fetchSuccessorObject(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
@@ -526,7 +526,7 @@ class BackendInterface {
526526
* @param key The key to fetch for
527527
* @param ledgerSequence The ledger sequence to fetch for
528528
* @param yield The coroutine context
529-
* @return The sucessor key on success; nullopt otherwise
529+
* @return The successor key on success; nullopt otherwise
530530
*/
531531
std::optional<ripple::uint256>
532532
fetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const;
@@ -537,7 +537,7 @@ class BackendInterface {
537537
* @param key The key to fetch for
538538
* @param ledgerSequence The ledger sequence to fetch for
539539
* @param yield The coroutine context
540-
* @return The sucessor on success; nullopt otherwise
540+
* @return The successor on success; nullopt otherwise
541541
*/
542542
virtual std::optional<ripple::uint256>
543543
doFetchSuccessorKey(ripple::uint256 key, std::uint32_t ledgerSequence, boost::asio::yield_context yield) const = 0;

src/data/CassandraBackend.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ class BasicCassandraBackend : public BackendInterface {
780780

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

785785
auto const res = executor_.read(yield, statement);
786786
if (res) {

src/data/LedgerCache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ LedgerCache::update(std::vector<LedgerObject> const& objs, uint32_t seq, bool is
6363
if (seq > latestSeq_) {
6464
ASSERT(
6565
seq == latestSeq_ + 1 || latestSeq_ == 0,
66-
"New sequense must be either next or first. seq = {}, latestSeq_ = {}",
66+
"New sequence must be either next or first. seq = {}, latestSeq_ = {}",
6767
seq,
6868
latestSeq_
6969
);

src/data/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ This table stores the list of transactions affecting a given account. This inclu
162162
```sql
163163
CREATE TABLE clio.successor (
164164
key blob, # Object index
165-
seq bigint, # The sequnce that this ledger object's predecessor and successor was updated
165+
seq bigint, # The sequence that this ledger object's predecessor and successor was updated
166166
next blob, # Index of the next object that existed in this sequence
167167
PRIMARY KEY (key, seq)
168168
) WITH CLUSTERING ORDER BY (seq ASC) ...

src/data/cassandra/Handle.hpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Handle {
8989
asyncConnect() const;
9090

9191
/**
92-
* @brief Synchonous version of the above.
92+
* @brief Synchronous version of the above.
9393
*
9494
* See @ref asyncConnect() const for how this works.
9595
*
@@ -108,7 +108,7 @@ class Handle {
108108
asyncConnect(std::string_view keyspace) const;
109109

110110
/**
111-
* @brief Synchonous version of the above.
111+
* @brief Synchronous version of the above.
112112
*
113113
* See @ref asyncConnect(std::string_view) const for how this works.
114114
*
@@ -127,7 +127,7 @@ class Handle {
127127
asyncDisconnect() const;
128128

129129
/**
130-
* @brief Synchonous version of the above.
130+
* @brief Synchronous version of the above.
131131
*
132132
* See @ref asyncDisconnect() const for how this works.
133133
*
@@ -146,7 +146,7 @@ class Handle {
146146
asyncReconnect(std::string_view keyspace) const;
147147

148148
/**
149-
* @brief Synchonous version of the above.
149+
* @brief Synchronous version of the above.
150150
*
151151
* See @ref asyncReconnect(std::string_view) const for how this works.
152152
*
@@ -172,7 +172,7 @@ class Handle {
172172
}
173173

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

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

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

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

284284
/**
285-
* @brief Synchonous version of the above.
285+
* @brief Synchronous version of the above.
286286
*
287287
* See @ref asyncExecute(std::vector<StatementType> const&) const for how this works.
288288
*

src/data/cassandra/Schema.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ class Schema {
633633
));
634634
}();
635635

636-
PreparedStatement selectAccountFromBegining = [this]() {
636+
PreparedStatement selectAccountFromBeginning = [this]() {
637637
return handle_.get().prepare(fmt::format(
638638
R"(
639639
SELECT account

src/data/cassandra/impl/AsyncExecutor.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
namespace data::cassandra::impl {
3939

4040
/**
41-
* @brief A query executor with a changable retry policy
41+
* @brief A query executor with a changeable retry policy
4242
*
4343
* Note: this is a bit of an anti-pattern and should be done differently
4444
* eventually.

src/data/cassandra/impl/ExecutionStrategy.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ class DefaultExecutionStrategy {
267267
}
268268

269269
/**
270-
* @brief Non-blocking query execution used for writing data. Constrast with write, this method does not execute
270+
* @brief Non-blocking query execution used for writing data. Contrast with write, this method does not execute
271271
* the statements in a batch.
272272
*
273273
* Retries forever with retry policy specified by @ref AsyncExecutor.

src/etl/ETLHelpers.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class ThreadSafeQueue {
143143
};
144144

145145
/**
146-
* @brief Parititions the uint256 keyspace into numMarkers partitions, each of equal size.
146+
* @brief Partitions the uint256 keyspace into numMarkers partitions, each of equal size.
147147
*
148148
* @param numMarkers Total markers to partition for
149149
* @return The markers

src/etl/ETLService.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ETLService::runETLPipeline(uint32_t startSequence, uint32_t numExtractors)
100100
}
101101

102102
// Main loop of ETL.
103-
// The software begins monitoring the ledgers that are validated by the nework.
103+
// The software begins monitoring the ledgers that are validated by the network.
104104
// The member networkValidatedLedgers_ keeps track of the sequences of ledgers validated by the network.
105105
// Whenever a ledger is validated by the network, the software looks for that ledger in the database. Once the ledger is
106106
// found in the database, the software publishes that ledger to the ledgers stream. If a network validated ledger is not

src/etl/ETLService.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ class ETLService : public etlng::ETLServiceInterface, ETLServiceTag {
340340
/**
341341
* @brief Get the number of markers to use during the initial ledger download.
342342
*
343-
* This is equivelent to the degree of parallelism during the initial ledger download.
343+
* This is equivalent to the degree of parallelism during the initial ledger download.
344344
*
345345
* @return The number of markers
346346
*/

src/etl/LedgerFetcherInterface.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct LedgerFetcherInterface {
4040
/**
4141
* @brief Extract data for a particular ledger from an ETL source
4242
*
43-
* This function continously tries to extract the specified ledger (using all available ETL sources) until the
43+
* This function continuously tries to extract the specified ledger (using all available ETL sources) until the
4444
* extraction succeeds, or the server shuts down.
4545
*
4646
* @param seq sequence of the ledger to extract
@@ -52,7 +52,7 @@ struct LedgerFetcherInterface {
5252
/**
5353
* @brief Extract diff data for a particular ledger from an ETL source.
5454
*
55-
* This function continously tries to extract the specified ledger (using all available ETL sources) until the
55+
* This function continuously tries to extract the specified ledger (using all available ETL sources) until the
5656
* extraction succeeds, or the server shuts down.
5757
*
5858
* @param seq sequence of the ledger to extract

src/etl/impl/ExtractionDataPipe.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class ExtractionDataPipe {
6666
/**
6767
* @brief Push new data package for the specified sequence.
6868
*
69-
* Note: Potentially blocks until the underlying queue can accomodate another entry.
69+
* Note: Potentially blocks until the underlying queue can accommodate another entry.
7070
*
7171
* @param sequence The sequence for which to enqueue the data package
7272
* @param data The data to store

0 commit comments

Comments
 (0)