Skip to content

Add codespell: config + action (to detect new typos) and make it fix a good number of them #11195

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Feature/improvement proposal
about: Propose a new feauture or improvement for Read the Docs
about: Propose a new feature or improvement for Read the Docs
---

## What's the problem this feature will solve?
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/aws-temporary-credentials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AWS temporary credentials
=========================

Builders run arbitrary commands provided by the user, while we run the commands in a sandboxed environment (docker),
that shouln't be the only line of defense, as we still interact with the files generated by the user outside docker for some operations.
that shouldn't be the only line of defense, as we still interact with the files generated by the user outside docker for some operations.

This is why instead of using credentials that have access to all the resources in AWS,
we are using credentials that are generated by the `AWS STS service <https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html>`__,
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/design/build-images.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ on each image without asking the users to change the image selected in their con
Then, when a completely different image appeared and after testing ``testing`` image enough,
we discarded ``stable``, old ``latest`` became the new ``stable`` and old ``testing`` became the new ``latest``.
This produced issues to people pinning their images to any of these names because after this change,
*we changed all the images for all the users* and many build issues arrised!
*we changed all the images for all the users* and many build issues arose!


Goals
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/design/future-builder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,6 @@ Final notes
- the project/build/user to expose a ``metadata.yaml`` with the contract that Read the Docs expects.
- none, some or all the integrations will be added to the HTML output (these have to be implemented at Read the Docs core)
- We are not responsible for extra formats (e.g. PDF, ePub, etc) on other tools.
- Focus on support Sphinx with nice integrations made in a tool-agnostic way that can be re-used.
- Focus on support Sphinx with nice integrations made in a tool-agnostic way that can be reused.
- Removing the manipulation of ``conf.py.tmpl`` does not require us to implement the same manipulation
for projects using the new potential feature ``sphinx.yaml`` file.
2 changes: 1 addition & 1 deletion docs/dev/design/new-search-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ now be objects.
We could just reuse the old response too,
since the only breaking changes would be the attributes now being objects,
and we aren't adding any new information to those objects (yet).
But also, re-using the current serializers shouldn't be a problem either.
But also, reusing the current serializers shouldn't be a problem either.

.. code-block:: json

Expand Down
4 changes: 2 additions & 2 deletions docs/dev/github-app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ GitHub App
Our GitHub App integration consists of a GitHub App (one for each platform, readthedocs.org and readthedocs.com),
which can be installed on a user's account or organization.

After installing the GitHub App, users can grant acccess to all repositories or select specific repositories,
After installing the GitHub App, users can grant access to all repositories or select specific repositories,
this allows Read the Docs to access the repositories and perform actions on them, such as reporting build statuses,
and subscribe to events like push and pull request events.

Expand Down Expand Up @@ -42,5 +42,5 @@ Security
- Since we make use of the installation to perform actions on the repositories instead of the user's OAuth2 token,
we make sure that only users with admin permissions on the repository can link the repository to a Read the Docs project.
- Once we lose access to a repository (e.g. the installation is uninstalled or revoked, or the project was deselected from the installation),
we remove the remote repository from the database, as we don't want to keep the relation bettween the project and the repository.
we remove the remote repository from the database, as we don't want to keep the relation between the project and the repository.
This is to prevent connecting the repository to the project again without the user's consent if they grant access to the repository again.
2 changes: 1 addition & 1 deletion docs/user/guides/creating-project-private-repository.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Configuring repository webhooks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Your repository will also need to be configured to push updates via webhooks to Read the Docs on repository events.
Webhook updates are used to automatically trigger new builds for your project and syncronize your repository's branches and tags.
Webhook updates are used to automatically trigger new builds for your project and synchronize your repository's branches and tags.

This step is the same for public repositories,
follow the directions for :doc:`manually configuring a Git repository integration </guides/setup/git-repo-manual>`.
2 changes: 1 addition & 1 deletion docs/user/img/screenshots/business.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
output: business-project-manual-team-select.png

# Project manual creation form, have to submit with a team first. The JS looks
# funny becuase Playwright needs to wait for the page to load before submitting.
# funny because Playwright needs to wait for the page to load before submitting.
- url: https://app.readthedocs.com/dashboard/import/manual/
javascript: |-
const _submit = () => {
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/api/v2/views/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def get_closed_external_version_response(self, project):

def update_default_branch(self, default_branch):
"""
Update the `Version.identifer` for `latest` with the VCS's `default_branch`.
Update the `Version.identifier` for `latest` with the VCS's `default_branch`.

The VCS's `default_branch` is the branch cloned when there is no specific branch specified
(e.g. `git clone <URL>`).
Expand Down
8 changes: 4 additions & 4 deletions readthedocs/api/v2/views/model_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def get_queryset(self):
If an API key is present, we filter by the project associated with the key.
Otherwise, we filter using our API manager method.

With this we check if the user/api key is authorized to acccess the object.
With this we check if the user/api key is authorized to access the object.
"""
api_key = getattr(self.request, "build_api_key", None)
if api_key:
Expand Down Expand Up @@ -263,7 +263,7 @@ def get_serializer_class(self):
"""
Return the proper serializer for UI and Admin.

This ViewSet has a sligtly different pattern since we want to
This ViewSet has a slightly different pattern since we want to
pre-process the `command` field before returning it to the user, and we
also want to have a specific serializer for admins.
"""
Expand Down Expand Up @@ -370,7 +370,7 @@ def retrieve(self, *args, **kwargs):
methods=["post"],
)
def reset(self, request, **kwargs):
"""Reset the build so it can be re-used when re-trying."""
"""Reset the build so it can be reused when re-trying."""
instance = self.get_object()
instance.reset()
return Response(status=status.HTTP_204_NO_CONTENT)
Expand Down Expand Up @@ -452,7 +452,7 @@ class NotificationViewSet(DisableListEndpoint, CreateModelMixin, UserSelectViewS

This endpoint is currently used only internally by the builder.
Notifications are attached to `Build` objects only when using this endpoint.
This limitation will change in the future when re-implementing this on APIv3 if neeed.
This limitation will change in the future when re-implementing this on APIv3 if needed.
"""

parser_classes = [JSONParser, MultiPartParser]
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/api/v3/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HasEmbedAPIAccess(BasePermission):
"""
Check if the project being accessed has access to the Embed API.

The embedded API V3 allows getting content from external sites tha
The embedded API V3 allows getting content from external sites that
aren't attached to a project. Those sites are restricted to the ones
from ``RTD_EMBED_API_EXTERNAL_DOMAINS``, so we just allow that.
"""
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/api/v3/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ def _validate_remote_repository(self, data):
Validate connection between `Project` and `RemoteRepository`.

We don't do anything in community, but we do ensure this relationship
is posible before creating the `Project` on commercial when the
is possible before creating the `Project` on commercial when the
organization has VCS SSO enabled.

If we cannot ensure the relationship here, this method should raise a
Expand Down
8 changes: 4 additions & 4 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ class APIVersion(Version):

project = None
# This is a property in the original model, in order to
# be able to assign it a value in the constructor, we need to re-declare it
# be able to assign it a value in the constructor, we need to redeclare it
# as an attribute here.
git_identifier = None

Expand Down Expand Up @@ -783,7 +783,7 @@ def config(self):
"""
# TODO: now that we are using a proper JSONField here, we could
# probably change this field to be a ForeignKey to avoid repeating the
# config file over and over again and re-use them to save db data as
# config file over and over again and reuse them to save db data as
# well
if self._config and self.CONFIG_KEY in self._config:
return Build.objects.only("_config").get(pk=self._config[self.CONFIG_KEY])._config
Expand Down Expand Up @@ -958,7 +958,7 @@ def external_version_name(self):

def reset(self):
"""
Reset the build so it can be re-used when re-trying.
Reset the build so it can be reused when re-trying.

Dates and states are usually overridden by the build,
we care more about deleting the commands.
Expand All @@ -981,7 +981,7 @@ class BuildCommandResultMixin:
Mixin for common command result methods/properties.

Shared methods between the database model :py:class:`BuildCommandResult` and
non-model respresentations of build command results from the API
non-model representations of build command results from the API
"""

@property
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/builds/version_slug.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def generate_version_slug(source):
ok=ok_chars,
space_replacement="-",
)
# Remove first character wile it's an invalid character for the beginning of the slug.
# Remove first character while it's an invalid character for the beginning of the slug.
slugified = slugified.lstrip(ok_chars)
return slugified

Expand Down
2 changes: 1 addition & 1 deletion readthedocs/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def validate_doc_types(self):
Validates that the user only have one type of documentation.

This should be called before validating ``sphinx`` or ``mkdocs`` to
avoid innecessary validations.
avoid unnecessary validations.
"""
with self.catch_validation_error("."):
if "sphinx" in self._raw_config and "mkdocs" in self._raw_config:
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/config/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
body=_(
textwrap.dedent(
"""
The name of the package <code>{{pacakge}}</code> is invalid.
The name of the package <code>{{package}}</code> is invalid.
"""
).strip(),
),
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ def clear_cache():
"""
# Code run before each test
yield
# Code run afer each test
# Code run after each test
cache.clear()
2 changes: 1 addition & 1 deletion readthedocs/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def get_filterset(self, **kwargs):
:param kwargs: Arguments to pass to ``FilterSet.__init__``
"""
# This method overrides the method from FilterMixin with differing
# arguments. We can switch this later if we ever resturcture the view
# arguments. We can switch this later if we ever restructure the view
# pylint: disable=arguments-differ
if not getattr(self, "filterset", None):
filterset_class = self.get_filterset_class()
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/management/commands/contact_owners.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Command(BaseCommand):
.. note::

If you need to extend the behavior or add a new use case,
we recommend creating a simple script file that re-use the methods
we recommend creating a simple script file that reuse the methods
and functions from this command.
This is an example to contact Domain owners:
https://gist.github.com/humitos/3e08ed4763a9312f5c0a9a997ea95a42
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class NullCharactersMiddleware:
when trying to save the content containing a NULL character into the
database, producing a 500 and creating an event in Sentry.

NULL characters are also used as an explotation technique, known as "Null Byte Injection".
NULL characters are also used as an exploitation technique, known as "Null Byte Injection".
"""

def __init__(self, get_response):
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/unresolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _unresolve(self, unresolved_domain, parsed_url, append_indexhtml):
"""
The actual unresolver.

Extracted into a separate method so it can be re-used by
Extracted into a separate method so it can be reused by
the unresolve and unresolve_path methods.
"""
current_project, version, filename = self._unresolve_path_with_parent_project(
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def extract_valid_attributes_for_model(model, attributes):
attributes = attributes.copy()
valid_field_names = {field.name for field in model._meta.get_fields()}
valid_attributes = {}
# We can't change a dictionary while interating over its keys,
# We can't change a dictionary while iterating over its keys,
# so we make a copy of its keys.
keys = list(attributes.keys())
for key in keys:
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/core/utils/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def safe_rmtree(path, *args, **kwargs):
"""
Wrapper around shutil.rmtree to check for symlinks.

shutil.rmtree doens't follow symlinks by default,
shutil.rmtree doesn't follow symlinks by default,
this function just logs in case users are trying to use symlinks.
https://docs.python.org/3/library/shutil.html#shutil.rmtree

Expand Down
8 changes: 4 additions & 4 deletions readthedocs/doc_builder/backends/sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, *args, **kwargs):
# `absolute_host_output_dir` because it's not defined in the host. So,
# we have to re-calculate its value. We will remove this limitation
# when we execute the whole building from inside the Docker container
# (instead behing a hybrid as it is now)
# (instead being a hybrid as it is now)
#
# We need to have two different paths that point to the exact same
# directory. How is that? The directory is mounted into a different
Expand Down Expand Up @@ -95,7 +95,7 @@ def __init__(self, *args, **kwargs):
#
# IMO, if there are multiple config files,
# the build should fail immediately communicating this to the user.
# This can be achived by unhandle the exception here
# This can be achieved by unhandle the exception here
# and leaving `on_failure` Celery handle to deal with it.
#
# In case there is no config file, we should continue the build
Expand Down Expand Up @@ -152,7 +152,7 @@ def build(self):
f"language={language}",
# Sphinx's source directory (SOURCEDIR).
# We are executing this command at the location of the `conf.py` file (CWD).
# TODO: ideally we should execute it from where the repository was clonned,
# TODO: ideally we should execute it from where the repository was cloned,
# but that could lead unexpected behavior to some users:
# https://github.com/readthedocs/readthedocs.org/pull/9888#issuecomment-1384649346
".",
Expand Down Expand Up @@ -321,7 +321,7 @@ def build(self):
f"language={language}",
# Sphinx's source directory (SOURCEDIR).
# We are executing this command at the location of the `conf.py` file (CWD).
# TODO: ideally we should execute it from where the repository was clonned,
# TODO: ideally we should execute it from where the repository was cloned,
# but that could lead unexpected behavior to some users:
# https://github.com/readthedocs/readthedocs.org/pull/9888#issuecomment-1384649346
".",
Expand Down
8 changes: 4 additions & 4 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def create_environment(self):
return

# If the builder is generic, we have nothing to do here,
# as the commnads are provided by the user.
# as the commands are provided by the user.
if self.data.config.doctype == GENERIC:
return

Expand All @@ -343,7 +343,7 @@ def install(self):
return

# If the builder is generic, we have nothing to do here,
# as the commnads are provided by the user.
# as the commands are provided by the user.
if self.data.config.doctype == GENERIC:
return

Expand Down Expand Up @@ -650,7 +650,7 @@ def install_build_tools(self):
]
):
# We cap setuptools to avoid breakage of projects
# relying on setup.py invokations,
# relying on setup.py invocations,
# see https://github.com/readthedocs/readthedocs.org/issues/8659
setuptools_version = (
"setuptools<58.3.0"
Expand Down Expand Up @@ -683,7 +683,7 @@ def build_docs_class(self, builder_class):
process.
"""
# If the builder is generic, we have nothing to do here,
# as the commnads are provided by the user.
# as the commands are provided by the user.
if builder_class == GENERIC:
return

Expand Down
4 changes: 2 additions & 2 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def save(self, api_client):
# TODO don't do this, address builds restarting instead.
# We try to post the buildcommand again as a temporary fix
# for projects that restart the build process. There seems to be
# something that causes a 404 during `patch()` in some biulds,
# something that causes a 404 during `patch()` in some builds,
# so we assume retrying `post()` for the build command is okay.
log.exception("Build command has an id but doesn't exist in the database.")
resp = api_client.command.post(data)
Expand Down Expand Up @@ -430,7 +430,7 @@ class BaseBuildEnvironment:
:param version: Project version that is being built
:param build: Build instance
:param environment: shell environment variables
:param record: whether or not record a build commands in the databse via
:param record: whether or not record a build commands in the database via
the API. The only case where we want this to be `False` is when
instantiating this class from `sync_repository_task` because it's a
background task that does not expose commands to the user.
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/filetreediff/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _sortpath(self, file: FileTreeDiffFile):
However, it doesn't group the results by directory.

Ideally, this should sort file names by hierarchy (less deep directory
first), groupping them by directory and alphabetically. We should update
first), grouping them by directory and alphabetically. We should update
this function to achieve that goal if we find a simple way to do it.
"""
parts = file.path.split("/")
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/integrations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def get_absolute_url(self) -> str | None:
projects we show a link in the UI to the GHA installation page for the
installation used by the project.
"""
# If the GHA is disconnected we'll disonnect the remote repository and
# If the GHA is disconnected we'll disconnect the remote repository and
# so we won't have a URL to the installation page the project should be
# using. We might want to store this on the model later so a repository
# that is removed from the installation can still link to the
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/notifications/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def get_rendered_body(self):
),
Message(
id=BuildUserError.BUILD_OUTPUT_OLD_DIRECTORY_USED,
header=_("Your project is outputing files in an old directory"),
header=_("Your project is outputting files in an old directory"),
body=_(
textwrap.dedent(
"""
Expand Down
Loading