From 221ba55f25dd9737010b4c56b0038d3b6c122d71 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:34:00 -0500 Subject: [PATCH 1/7] Add github action to codespell develop on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..748abfb5 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within pyproject.toml +--- +name: Codespell + +on: + push: + branches: [develop] + pull_request: + branches: [develop] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 From d8bf3302882fb53a687060e67f3de10fba803ddb Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:34:00 -0500 Subject: [PATCH 2/7] Add rudimentary codespell config --- pyproject.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 15870ef7..dca71d28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,3 +42,10 @@ newrelic = "^10.2.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git*,*.svg,*.lock' +check-hidden = true +# ignore-regex = '' +# ignore-words-list = '' From 3c1852b2d6669fc1adfbc154d5eceef3d95cc0ae Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:34:00 -0500 Subject: [PATCH 3/7] Add pre-commit definition for codespell --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index deb808d2..8e3327e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,10 @@ repos: rev: 5.12.0 hooks: - id: isort + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli From e130aeccd2ab3a13a763639d198131b2a6ec1621 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:34:54 -0500 Subject: [PATCH 4/7] Ignores for codespell --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dca71d28..5f3ceee2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,5 +47,5 @@ build-backend = "poetry.core.masonry.api" # Ref: https://github.com/codespell-project/codespell#using-a-config-file skip = '.git*,*.svg,*.lock' check-hidden = true -# ignore-regex = '' +ignore-regex = '\bassertIn\b' # ignore-words-list = '' From 43dbe4bb713c54598a0100cf570960ba3a533c7a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:35:45 -0500 Subject: [PATCH 5/7] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2 ./addon_toolkit/tests/_doctest.py", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- addon_toolkit/tests/_doctest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon_toolkit/tests/_doctest.py b/addon_toolkit/tests/_doctest.py index 60239610..39cbf9f0 100644 --- a/addon_toolkit/tests/_doctest.py +++ b/addon_toolkit/tests/_doctest.py @@ -15,7 +15,7 @@ def load_doctests(*modules): load_tests = load_doctests(my.module.with.doctests) ``` - (if there's a need, could support pass-thru kwargs to DocTestSuite) + (if there's a need, could support pass-through kwargs to DocTestSuite) """ def _load_tests(loader, tests, pattern): From a84eff610bdfbdf6dd52c11dc6ee4a6eb3eff2bf Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:35:48 -0500 Subject: [PATCH 6/7] [DATALAD RUNCMD] run codespell throughout fixing few left typos automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- addon_service/common/filtering.py | 2 +- addon_service/common/jsonapi.py | 2 +- addon_service/common/viewsets.py | 2 +- addon_service/oauth2/models.py | 2 +- addon_service/tests/_helpers.py | 2 +- addon_toolkit/declarator.py | 4 ++-- addon_toolkit/imp.py | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/addon_service/common/filtering.py b/addon_service/common/filtering.py index 84c7435b..2b867044 100644 --- a/addon_service/common/filtering.py +++ b/addon_service/common/filtering.py @@ -41,7 +41,7 @@ def extract_filter_expressions( Since no formal JSON:API scheme exists for complex filter operations, we have settled on the following norm: Filter params can have either one or two arguments. The first argument MUST be a field on the serialized output of the endpoint - The second arugment is an OPTIONAL comparison operator (i.e. `icontains`, `lte`, etc.) + The second argument is an OPTIONAL comparison operator (i.e. `icontains`, `lte`, etc.) >>> from addon_service.models import UserReference >>> class DemoSerializer(serializers.Serializer): diff --git a/addon_service/common/jsonapi.py b/addon_service/common/jsonapi.py index 71f0177a..05fba19c 100644 --- a/addon_service/common/jsonapi.py +++ b/addon_service/common/jsonapi.py @@ -88,7 +88,7 @@ def __str__(self): def group_query_params_by_family( query_items: Iterable[tuple[str, Iterable[str] | str]] ) -> QueryParamFamilies: - """Extracts JSON:API query familes from a list of (ParameterName, ParameterValues) tuples. + """Extracts JSON:API query families from a list of (ParameterName, ParameterValues) tuples. Data should be pre-normalized before calling, such as by using the results of `urllib.parse.parse_qs(...).items()` or `django.utils.QueryDict.lists()` diff --git a/addon_service/common/viewsets.py b/addon_service/common/viewsets.py index 4f20b36f..d706d89a 100644 --- a/addon_service/common/viewsets.py +++ b/addon_service/common/viewsets.py @@ -39,7 +39,7 @@ class RestrictedReadOnlyViewSet(ReadOnlyModelViewSet): `v1/user-references/?filter[user_uri]={uri}` to act as an alternative to `v1/user-references/{pk}` - in the case where the caller only has the publicly avaialable uri as a key + in the case where the caller only has the publicly available uri as a key """ def list(self, request, *args, **kwargs): diff --git a/addon_service/oauth2/models.py b/addon_service/oauth2/models.py index c9fcd5f3..82de80e8 100644 --- a/addon_service/oauth2/models.py +++ b/addon_service/oauth2/models.py @@ -126,7 +126,7 @@ def validate_shared_client(self): ) if len(client_configs) != 1: raise ValidationError( - "OAuth2 Token Metadata is linked to mulitple services/clients" + "OAuth2 Token Metadata is linked to multiple services/clients" ) @sync_to_async diff --git a/addon_service/tests/_helpers.py b/addon_service/tests/_helpers.py index 4a036338..9fc16829 100644 --- a/addon_service/tests/_helpers.py +++ b/addon_service/tests/_helpers.py @@ -40,7 +40,7 @@ class MockOSF: def __init__(self, permissions=None): """A lightweight, configurable mock of OSF for testing remote permissions. - Accepts a mapping of arbitrary resource_uris to user permissiosn and `public` status + Accepts a mapping of arbitrary resource_uris to user permissions and `public` status { 'osf.io/abcde': {'osf.io/bcdef': 'write', 'osf.io/cdefg': 'admin', 'public': True}, 'osf.io/zyxwv': {'osf.io/yxwvut': 'read', 'public': False} diff --git a/addon_toolkit/declarator.py b/addon_toolkit/declarator.py index 5b71054b..255fa2c8 100644 --- a/addon_toolkit/declarator.py +++ b/addon_toolkit/declarator.py @@ -127,7 +127,7 @@ class ClassDeclarator(Declarator): with shorthand declarator: >>> semver = ClassDeclarator(SemanticVersionDeclaration, field_for_subject='subj') - for declarating classes: + for declaring classes: >>> @semver( ... major=4, ... minor=2, @@ -152,7 +152,7 @@ class ClassDeclarator(Declarator): ... ValueError: no declaration found for - to recognize a subclass of a declarated class, use `get_declaration_for_class` (returns the first declaration found on items in `__mro__`) + to recognize a subclass of a declared class, use `get_declaration_for_class` (returns the first declaration found on items in `__mro__`) >>> semver.get_declaration_for_class(Foo) SemanticVersionDeclaration(major=4, minor=2, patch=9, subj=) diff --git a/addon_toolkit/imp.py b/addon_toolkit/imp.py index 241ab413..67c35e0d 100644 --- a/addon_toolkit/imp.py +++ b/addon_toolkit/imp.py @@ -73,7 +73,7 @@ def get_operation_declaration( return _operation @classmethod - def confirm_credentials(cls, crendentials): ... + def confirm_credentials(cls, credentials): ... ### # instance methods From 3b8a199e0f8cf245725eb3fc76c412134632cf3d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 5 Feb 2025 13:36:22 -0500 Subject: [PATCH 7/7] TEMP: add typo --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d6bcfe89..16afbdf4 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,4 @@ If you encounter a bug, have a technical question, or want to request a feature, at help@osf.io. While we may respond to questions through other channels, reaching out to us at help@osf.io ensures that your feedback goes to the right person promptly. If you're considering posting an issue on our GitHub issues page, we recommend sending it to help@osf.io instead. +avaialable