Skip to content

Commit e9ae09d

Browse files
authored
DRIVERS-2790 Add codespell checker (#1491)
* Add codespell checker * fix table * include json and yml * remove trailing newline
1 parent 5fc23f4 commit e9ae09d

39 files changed

+93
-94
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.4.0
4+
rev: v4.5.0
55
hooks:
66
- id: check-case-conflict
77
- id: check-executables-have-shebangs
@@ -44,7 +44,7 @@ repos:
4444
stages: [manual]
4545

4646
- repo: https://github.com/python-jsonschema/check-jsonschema
47-
rev: 0.26.3
47+
rev: 0.27.3
4848
hooks:
4949
- id: check-github-workflows
5050

@@ -55,8 +55,8 @@ repos:
5555
- id: rst-directive-colons
5656
- id: rst-inline-touching-normal
5757

58-
# - repo: https://github.com/codespell-project/codespell
59-
# rev: "v2.2.6"
60-
# hooks:
61-
# - id: codespell
62-
# exclude_types: [json,yaml]
58+
- repo: https://github.com/codespell-project/codespell
59+
rev: "v2.2.6"
60+
hooks:
61+
- id: codespell
62+
args: ["-L", "fle,re-use,merchantibility,synching,crate,nin,infinit,te"]

source/auth/auth.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ BSON representation and a human-readable "friendly name" which is used in this s
759759
Name Friendly Name Type Description
760760
==== ==================== ================= ==============================================================================================================================================
761761
r client nonce BinData Subtype 0 32 byte cryptographically secure random number
762-
p gs2-cb-flag int32 The integer representation of the ASCII charater 'n' or 'y', i.e., ``110`` or ``121``
762+
p gs2-cb-flag int32 The integer representation of the ASCII character 'n' or 'y', i.e., ``110`` or ``121``
763763
s server nonce BinData Subtype 0 64 bytes total, 32 bytes from the client first message and a 32 byte cryptographically secure random number generated by the server
764764
h sts host string FQDN of the STS service
765765
a authorization header string Authorization header for `AWS Signature Version 4 <https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html?shortFooter=true>`_
@@ -776,7 +776,7 @@ Conversation
776776
````````````
777777

778778
The first message sent by drivers MUST contain a ``client nonce`` and ``gs2-cb-flag``. In response, the server will send a ``server nonce``
779-
and ``sts host``. Drivers MUST validate that the server nonce is exactly 64 bytes and the first 32 bytes are the same as the client nonce. Drivers MUST also validate that the length of the host is greater than 0 and less than or equal to 255 bytes per `RFC 1035 <https://tools.ietf.org/html/rfc1035>`_. Drivers MUST reject FQDN names with empty lables (e.g., "abc..def"), names that start with a period (e.g., ".abc.def") and names that end with a period (e.g., "abc.def."). Drivers MUST respond to the server's message with an ``authorization header`` and a ``date``.
779+
and ``sts host``. Drivers MUST validate that the server nonce is exactly 64 bytes and the first 32 bytes are the same as the client nonce. Drivers MUST also validate that the length of the host is greater than 0 and less than or equal to 255 bytes per `RFC 1035 <https://tools.ietf.org/html/rfc1035>`_. Drivers MUST reject FQDN names with empty labels (e.g., "abc..def"), names that start with a period (e.g., ".abc.def") and names that end with a period (e.g., "abc.def."). Drivers MUST respond to the server's message with an ``authorization header`` and a ``date``.
780780

781781
As an example, given a client nonce value of "dzw1U2IwSEtgaWI0IUxZMVJqc2xuQzNCcUxBc05wZjI=", a MONGODB-AWS conversation decoded from
782782
BSON to JSON would appear as follows:
@@ -888,7 +888,7 @@ Body Action=GetCallerIdentity&Version=2011-06-15
888888
Region Calculation
889889
``````````````````
890890

891-
To get the region from the host, the driver MUST follow the algorithm expressed in psuedocode below. ::
891+
To get the region from the host, the driver MUST follow the algorithm expressed in pseudocode below. ::
892892

893893
if the host is invalid according to the rules described earlier
894894
the region is undefined and the driver must raise an error.
@@ -1067,7 +1067,7 @@ would be with other credential responses.
10671067

10681068
ECS endpoint
10691069
____________
1070-
If a username and password are not provided and the aforementioned enviornment variables are not set, drivers MUST query a link-local AWS address for temporary credentials.
1070+
If a username and password are not provided and the aforementioned environment variables are not set, drivers MUST query a link-local AWS address for temporary credentials.
10711071
If temporary credentials cannot be obtained then drivers MUST fail authentication and raise an error. Drivers SHOULD
10721072
enforce a 10 second read timeout while waiting for incoming content from both the ECS and EC2 endpoints. If the
10731073
environment variable ``AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`` is set then drivers MUST assume that it was set by an
@@ -1155,15 +1155,15 @@ Caching Credentials
11551155
___________________
11561156
Credentials fetched by the driver using AWS endpoints MUST be cached and reused
11571157
to avoid hitting AWS rate limitations. AWS recommends using a suitable
1158-
Software Development Kit (SDK) for your langauge. If that SDK supports
1158+
Software Development Kit (SDK) for your language. If that SDK supports
11591159
credential fetch and automatic refresh/caching, then that mechanism can
11601160
be used in lieu of manual caching.
11611161

11621162
If using manual caching, the "Expiration" field MUST be stored
11631163
and used to determine when to clear the cache. Credentials are considered
11641164
valid if they are more than five minutes away from expiring; to the reduce the
11651165
chance of expiration before they are validated by the server. Credentials
1166-
that are retreived from environment variables MUST NOT be cached.
1166+
that are retrieved from environment variables MUST NOT be cached.
11671167

11681168
If there are no current valid cached credentials, the driver MUST initiate a
11691169
credential request. To avoid adding a bottleneck that would override the
@@ -1460,8 +1460,8 @@ Implementation
14601460

14611461
#. Credentials MAY be specified in the connection string immediately after the scheme separator "//".
14621462
#. A realm MAY be passed as a part of the username in the url. It would be something like [email protected], where dev is the username and MONGODB.COM is the realm. Per the RFC, the @ symbol should be url encoded using %40.
1463-
* When GSSAPI is specified, this should be interpretted as the realm.
1464-
* When non-GSSAPI is specified, this should be interpetted as part of the username.
1463+
* When GSSAPI is specified, this should be interpreted as the realm.
1464+
* When non-GSSAPI is specified, this should be interpreted as part of the username.
14651465
#. It is permissible for only the username to appear in the connection string. This would be identified by having no colon follow the username before the '@' hostname separator.
14661466
#. The source is determined by the following:
14671467
* if authSource is specified, it is used.
@@ -1509,13 +1509,13 @@ For the example users above, the ``dbstats`` command could be used as a test
15091509
command.
15101510

15111511
For a test user supporting both SCRAM-SHA-1 and SCRAM-SHA-256, drivers should
1512-
verify that negotation selects SCRAM-SHA-256. This may require monkey
1512+
verify that negotiation selects SCRAM-SHA-256. This may require monkey
15131513
patching, manual log analysis, etc.
15141514

15151515
Step 3
15161516
------
15171517

1518-
For test users that support only one mechanism, verify that explictly specifying
1518+
For test users that support only one mechanism, verify that explicitly specifying
15191519
the other mechanism fails.
15201520

15211521
For a non-existent username, verify that not specifying a mechanism when

source/auth/tests/mongodb-oidc.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ Separate Connections Avoid Extra Callback Calls
429429
- Create request and refresh callbacks that return tokens that will not expire
430430
soon. Ensure that we can record the number of times each callback is called.
431431
- Create two clients using the callbacks
432-
- Peform a find operation on each client that succeeds.
432+
- Perform a find operation on each client that succeeds.
433433
- Ensure that the request callback has been called once and the refresh
434434
callback has not been called.
435435
- Force a reauthenication on the first client using a ``failCommand`` of the
@@ -450,10 +450,10 @@ Separate Connections Avoid Extra Callback Calls
450450
}
451451
}
452452
453-
- Perform a ``find`` operation that succeds.
453+
- Perform a ``find`` operation that succeeds.
454454
- Ensure that the request callback has been called once and the refresh
455455
callback has been called once.
456456
- Repeat the ``failCommand`` and ``find`` operation on the second client.
457457
- Ensure that the request callback has been called once and the refresh
458458
callback has been called once.
459-
- Close both clients.
459+
- Close both clients.

source/bson-corpus/bson-corpus.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Goals
4646
Non-Goals
4747
---------
4848

49-
* Replace or extend the offical BSON spec at http://bsonspec.org.
49+
* Replace or extend the official BSON spec at http://bsonspec.org.
5050

5151
* Provide a formal specification for ``extjson``.
5252

source/change-streams/change-streams.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ The stage has the following shape:
597597
598598
The first parameter of the helpers specifies an array of aggregation pipeline stages which MUST be appended to the initial stage. Drivers MUST support an empty pipeline. Languages which support default parameters MAY specify an empty array as the default value for this parameter. Drivers SHOULD otherwise make specification of a pipeline as similar as possible to the `aggregate <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ CRUD method.
599599

600-
Additionally, implementors MAY provide a form of these methods which require no parameters, assuming no options and no additional stages beyond the initial ``$changeStream`` stage:
600+
Additionally, implementers MAY provide a form of these methods which require no parameters, assuming no options and no additional stages beyond the initial ``$changeStream`` stage:
601601

602602
.. code:: python
603603
@@ -616,7 +616,7 @@ A driver MUST NOT throw an exception if any unsupported stage is provided, but i
616616

617617
A driver MUST NOT throw an exception if a user adds, removes, or modifies fields using ``$project``. The server will produce an error if ``_id``
618618
is projected out, but a user should otherwise be able to modify the shape of the change stream event as desired. This may require the result
619-
to be deserialized to a ``BsonDocument`` or custom-defined type rather than a ``ChangeStreamDocument``. It is the responsiblity of the
619+
to be deserialized to a ``BsonDocument`` or custom-defined type rather than a ``ChangeStreamDocument``. It is the responsibility of the
620620
user to ensure that the deserialized type is compatible with the specified ``$project`` stage.
621621

622622
The aggregate helper methods MUST have no new logic related to the ``$changeStream`` stage. Drivers MUST be capable of handling `TAILABLE_AWAIT <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ cursors from the aggregate command in the same way they handle such cursors from find.
@@ -679,7 +679,7 @@ Drivers MUST use the ``ns`` returned in the ``aggregate`` command to set the ``c
679679
ChangeStream
680680
------------
681681

682-
A ``ChangeStream`` is an abstraction of a `TAILABLE_AWAIT <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ cursor, with support for resumability. Implementors MAY choose to implement a ``ChangeStream`` as an extension of an existing tailable cursor implementation. If the ``ChangeStream`` is implemented as a type which owns a tailable cursor, then the implementor MUST provide a manner of closing the change stream, as well as satisfy the requirements of extending ``Iterable<Document>``. If your language has an idiomatic way of disposing of resources you MAY choose to implement that in addition to, or instead of, an explicit close method.
682+
A ``ChangeStream`` is an abstraction of a `TAILABLE_AWAIT <https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#read>`_ cursor, with support for resumability. Implementers MAY choose to implement a ``ChangeStream`` as an extension of an existing tailable cursor implementation. If the ``ChangeStream`` is implemented as a type which owns a tailable cursor, then the implementer MUST provide a manner of closing the change stream, as well as satisfy the requirements of extending ``Iterable<Document>``. If your language has an idiomatic way of disposing of resources you MAY choose to implement that in addition to, or instead of, an explicit close method.
683683

684684
A change stream MUST track the last resume token, per `Updating the Cached Resume Token`_.
685685

@@ -705,7 +705,7 @@ The server expects ``startAtOperationTime`` as a BSON Timestamp. Drivers MUST al
705705

706706
``startAtOperationTime``, ``resumeAfter``, and ``startAfter`` are all mutually exclusive; if any two are set, the server will return an error. Drivers MUST NOT throw a custom error, and MUST defer to the server error.
707707

708-
The ``ChangeStream`` MUST save the ``operationTime`` from the initial ``aggregate`` response when the following critera are met:
708+
The ``ChangeStream`` MUST save the ``operationTime`` from the initial ``aggregate`` response when the following criteria are met:
709709

710710
- None of ``startAtOperationTime``, ``resumeAfter``, ``startAfter`` were specified in the ``ChangeStreamOptions``.
711711
- The max wire version is >= ``7``.

source/client-side-encryption/client-side-encryption.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ for explicit encryption only (i.e. on the ClientEncryption class).
15391539
For purposes of testing, a driver may use a different set of search paths.
15401540
15411541
1542-
.. rubric:: Explaination
1542+
.. rubric:: Explanation
15431543
15441544
The `search paths`_ array in libmongocrypt_ allows the driver to customize the
15451545
way that libmongocrypt_ searches and loads the crypt_shared_ library. For testing
@@ -2419,15 +2419,15 @@ Why are serverSelectionTryOnce and cooldownMS disabled for single-threaded drive
24192419
By default, single threaded clients set serverSelectionTryOnce to true, which
24202420
means server selection fails if a topology scan fails the first time (i.e. it
24212421
will not make repeat attempts until serverSelectionTimeoutMS expires). This
2422-
behavior is overriden since there may be a small delay between spawning
2422+
behavior is overridden since there may be a small delay between spawning
24232423
mongocryptd (which the driver may be responsible for) and for mongocryptd to
24242424
listen on sockets. See the Server Selection spec description of `serverSelectionTryOnce <../server-selection/server-selection.rst#serverselectiontryonce>`_.
24252425
24262426
Similarly, single threaded clients will by default wait for 5 second cooldown
24272427
period after failing to connect to a server before making another attempt.
24282428
Meaning if the first attempt to mongocryptd fails to connect, then the user
24292429
would observe a 5 second delay. This is not configurable in the URI, so this
2430-
must be overriden internally. Since mongocryptd is a local process, there should
2430+
must be overridden internally. Since mongocryptd is a local process, there should
24312431
only be a very short delay after spawning mongocryptd for it to start listening
24322432
on sockets. See the SDAM spec description of `cooldownMS <../source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#cooldownms>`__.
24332433

source/client-side-encryption/etc/test-templates/fle2v2-MissingKey.yml.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data: [
1919
encrypted_fields: {{ yamlfile("encryptedFields.json") }}
2020
key_vault_data: []
2121
tests:
22-
- description: "FLE2 encrypt fails with mising key"
22+
- description: "FLE2 encrypt fails with missing key"
2323
clientOptions:
2424
autoEncryptOpts:
2525
kmsProviders:
@@ -30,7 +30,7 @@ tests:
3030
document: { _id: 1, encryptedIndexed: "123" }
3131
result:
3232
errorContains: "not all keys requested were satisfied"
33-
- description: "FLE2 decrypt fails with mising key"
33+
- description: "FLE2 decrypt fails with missing key"
3434
clientOptions:
3535
autoEncryptOpts:
3636
kmsProviders:

source/client-side-encryption/tests/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ Drivers that do not support an unlimited maximum pool size MUST skip this test.
13081308
The following tests that connections to KMS servers with TLS verify peer certificates.
13091309

13101310
The two tests below make use of mock KMS servers which can be run on Evergreen using `the mock KMS server script <https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/csfle/kms_http_server.py>`_.
1311-
Drivers can set up their local Python enviroment for the mock KMS server by running `the virtualenv activation script <https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/csfle/activate_venv.sh>`_.
1311+
Drivers can set up their local Python environment for the mock KMS server by running `the virtualenv activation script <https://github.com/mongodb-labs/drivers-evergreen-tools/blob/master/.evergreen/csfle/activate_venv.sh>`_.
13121312

13131313
To start two mock KMS servers, one on port 9000 with `ca.pem`_ as a CA file and `expired.pem`_ as a cert file, and one on port 9001 with `ca.pem`_ as a CA file and `wrong-host.pem`_ as a cert file,
13141314
run the following commands from the ``.evergreen/csfle`` directory:

source/client-side-encryption/tests/legacy/fle2v2-MissingKey.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/client-side-encryption/tests/legacy/fle2v2-MissingKey.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ data: [
1919
encrypted_fields: {'fields': [{'keyId': {'$binary': {'base64': 'EjRWeBI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedIndexed', 'bsonType': 'string', 'queries': {'queryType': 'equality', 'contention': {'$numberLong': '0'}}}, {'keyId': {'$binary': {'base64': 'q83vqxI0mHYSNBI0VniQEg==', 'subType': '04'}}, 'path': 'encryptedUnindexed', 'bsonType': 'string'}]}
2020
key_vault_data: []
2121
tests:
22-
- description: "FLE2 encrypt fails with mising key"
22+
- description: "FLE2 encrypt fails with missing key"
2323
clientOptions:
2424
autoEncryptOpts:
2525
kmsProviders:
@@ -30,7 +30,7 @@ tests:
3030
document: { _id: 1, encryptedIndexed: "123" }
3131
result:
3232
errorContains: "not all keys requested were satisfied"
33-
- description: "FLE2 decrypt fails with mising key"
33+
- description: "FLE2 decrypt fails with missing key"
3434
clientOptions:
3535
autoEncryptOpts:
3636
kmsProviders:

0 commit comments

Comments
 (0)