Skip to content

Commit 1571f80

Browse files
authored
Add pre-commit hook for common misspelling check in files (#18964)
This PR adds codespell to the pre-commit hooks. This will specifically help us a bit in resolving sphinx errors. From the project page: It does not check for word membership in a complete dictionary, but instead looks for a set of common misspellings. Therefore it should catch errors like "adn", but it will not catch "adnasdfasdf". This also means it shouldn't generate false-positives when you use a niche term it doesn't know about. This means the sphinx errors are not solved completely.
1 parent 141d9f2 commit 1571f80

File tree

42 files changed

+69
-47
lines changed

Some content is hidden

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

42 files changed

+69
-47
lines changed

β€Ž.github/workflows/build-images.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,12 @@ jobs:
307307
- name: "Build PROD images ${{ matrix.python-version }}:${{ env.GITHUB_REGISTRY_PUSH_IMAGE_TAG }}"
308308
run: ./scripts/ci/images/ci_prepare_prod_image_on_ci.sh
309309
env:
310-
# GITHUB_REGISTRY_PULL_IMAGE_TAG is overriden to latest in order to build PROD image using "latest"
310+
# GITHUB_REGISTRY_PULL_IMAGE_TAG is overridden to latest in order to build PROD image using "latest"
311311
GITHUB_REGISTRY_PULL_IMAGE_TAG: "latest"
312312
- name: "Push PROD images ${{ matrix.python-version }}:${{ env.GITHUB_REGISTRY_PUSH_IMAGE_TAG }}"
313313
run: ./scripts/ci/images/ci_push_production_images.sh
314314
env:
315-
# GITHUB_REGISTRY_PULL_IMAGE_TAG is overriden to latest in order to build PROD image using "latest"
315+
# GITHUB_REGISTRY_PULL_IMAGE_TAG is overridden to latest in order to build PROD image using "latest"
316316
GITHUB_REGISTRY_PULL_IMAGE_TAG: "latest"
317317

318318
cancel-on-ci-build:

β€Ž.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ repos:
258258
exclude: |
259259
(?x)
260260
^airflow/_vendor/
261+
- repo: https://github.com/codespell-project/codespell
262+
rev: v2.1.0
263+
hooks:
264+
- id: codespell
265+
name: Run codespell to check for common misspellings in files
266+
entry: codespell
267+
language: python
268+
types: [text]
269+
exclude: ^airflow/_vendor/|^CHANGELOG.txt|^airflow/www/static/css/material-icons.css
270+
args:
271+
- --ignore-words=docs/spelling_wordlist.txt
272+
- --skip=docs/*/commits.rst,airflow/providers/*/*.rst,*.lock,INTHEWILD.md,*.min.js
261273
- repo: local
262274
hooks:
263275
- id: lint-openapi

β€ŽBREEZE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2191,7 +2191,7 @@ This is the current syntax for `./breeze <./breeze>`_:
21912191
check-executables-have-shebangs check-extras-order check-hooks-apply
21922192
check-integrations check-merge-conflict check-xml daysago-import-check
21932193
debug-statements detect-private-key doctoc dont-use-safe-filter end-of-file-fixer
2194-
fix-encoding-pragma flake8 flynt forbid-tabs helm-lint identity
2194+
fix-encoding-pragma flake8 flynt codespell forbid-tabs helm-lint identity
21952195
incorrect-use-of-LoggingMixin insert-license isort json-schema language-matters
21962196
lint-dockerfile lint-openapi markdownlint mermaid mixed-line-ending mypy mypy-helm
21972197
no-providers-in-core-examples no-relative-imports pre-commit-descriptions

β€ŽSTATIC_CODE_CHECKS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ require Breeze Docker images to be installed locally.
188188
------------------------------------ ---------------------------------------------------------------- ------------
189189
``flynt`` Runs flynt
190190
------------------------------------ ---------------------------------------------------------------- ------------
191+
``codespell`` Checks for common misspellings in files.
192+
------------------------------------ ---------------------------------------------------------------- ------------
191193
``forbid-tabs`` Fails if tabs are used in the project
192194
------------------------------------ ---------------------------------------------------------------- ------------
193195
``helm-lint`` Verifies if helm lint passes for the chart

β€ŽUPDATING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ No breaking changes.
283283
284284
### `activate_dag_runs` argument of the function `clear_task_instances` is replaced with `dag_run_state`
285285
286-
To achieve the previous default behaviour of `clear_task_instances` with `activate_dag_runs=True`, no change is needed. To achieve the previous behaviour of `activate_dag_runs=False`, pass `dag_run_state=False` instead. (The previous paramater is still accepted, but is deprecated)
286+
To achieve the previous default behaviour of `clear_task_instances` with `activate_dag_runs=True`, no change is needed. To achieve the previous behaviour of `activate_dag_runs=False`, pass `dag_run_state=False` instead. (The previous parameter is still accepted, but is deprecated)
287287
288288
### `dag.set_dag_runs_state` is deprecated
289289

β€Žairflow/_vendor/connexion/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .apps import AbstractApp # NOQA
77
from .decorators.produces import NoContent # NOQA
88
from .exceptions import ProblemException # NOQA
9-
# add operation for backwards compatability
9+
# add operation for backwards compatibility
1010
from .operations import compat
1111
from .problem import problem # NOQA
1212
from .resolver import Resolution, Resolver, RestyResolver # NOQA

β€Žairflow/example_dags/plugins/workday.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19-
"""Plugin to demostrate timetable registration and accomdate example DAGs."""
19+
"""Plugin to demonstrate timetable registration and accommodate example DAGs."""
2020

2121
# [START howto_timetable]
2222
from datetime import timedelta

β€Žairflow/providers/cncf/kubernetes/utils/pod_launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def read_pod_logs(
263263
)
264264
except BaseHTTPError:
265265
self.log.exception('There was an error reading the kubernetes API.')
266-
# Reraise to be catched by self.monitor_pod.
266+
# Reraise to be caught by self.monitor_pod.
267267
raise
268268

269269
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True)

β€Žairflow/providers/google/cloud/hooks/bigquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ def _build_new_schema(
14221422
# Turn schema_field_updates into a dict keyed on field names
14231423
schema_fields_updates = {field["name"]: field for field in deepcopy(schema_fields_updates)}
14241424

1425-
# Create a new dict for storing the new schema, initated based on the current_schema
1425+
# Create a new dict for storing the new schema, initiated based on the current_schema
14261426
# as of Python 3.6, dicts retain order.
14271427
new_schema = {field["name"]: field for field in deepcopy(current_schema)}
14281428

β€Žairflow/providers/microsoft/azure/operators/wasb_delete_blob.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def __init__(
6565
self.ignore_if_missing = ignore_if_missing
6666

6767
def execute(self, context: dict) -> None:
68-
self.log.info('Deleting blob: %s\nin wasb://%s', self.blob_name, self.container_name)
68+
self.log.info('Deleting blob: %s\n in wasb://%s', self.blob_name, self.container_name)
6969
hook = WasbHook(wasb_conn_id=self.wasb_conn_id)
7070

7171
hook.delete_file(

0 commit comments

Comments
 (0)