Skip to content

Commit db23bcc

Browse files
Add codespell in pre-commit, fix existing typo, create a custom dict (#438)
1 parent ce86aaa commit db23bcc

9 files changed

+21
-10
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ repos:
2929
- id: pyproject-fmt
3030
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
3131
additional_dependencies: ["tox>=4.9"]
32+
- repo: https://github.com/codespell-project/codespell
33+
rev: v2.3.0
34+
hooks:
35+
- id: codespell
36+
args: ["--toml=pyproject.toml"]
37+
additional_dependencies:
38+
- tomli
3239
- repo: local
3340
hooks:
3441
- id: pylint

CHANGELOG.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Version 2.0.4 (do not use)
282282
Version 2.0.3 (do not use)
283283
--------------------------
284284

285-
- Fixing compatability between ranges of astroid (2.0.4 -> 2.1) and
285+
- Fixing compatibility between ranges of astroid (2.0.4 -> 2.1) and
286286
pylint (2.1.1 -> 2.2).
287287
`#201 <https://github.com/pylint-dev/pylint-django/issues/201>`_ and
288288
`#202 <https://github.com/pylint-dev/pylint-django/issues/202>`_
@@ -550,7 +550,7 @@ Version 0.5.5
550550
Version 0.5.4
551551
-------------
552552

553-
- Improved resiliance to inference failure when Django types cannot be
553+
- Improved resilience to inference failure when Django types cannot be
554554
inferred (which can happen if Django is not on the system path
555555

556556
Version 0.5.3
@@ -578,7 +578,7 @@ Version 0.5
578578
Improved handling of Django model fields
579579
- `Issue #10 <https://github.com/PyCQA/pylint-django/issues/10>`__ No
580580
warning about missing **unicode** if the Django python3/2
581-
compatability tools are used
581+
compatibility tools are used
582582
- `Issue #11 <https://github.com/PyCQA/pylint-django/issues/11>`__
583583
Improved handling of Django form fields
584584
- `Issue #12 <https://github.com/PyCQA/pylint-django/issues/12>`__

custom_dict.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
astroid

pylint_django/augmentations/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# get its attributes that way - and this used to be the method - but unfortunately
3131
# there's no guarantee that Django is properly configured at that stage, and importing
3232
# anything from the django.db package causes an ImproperlyConfigured exception.
33-
# Therefore we'll fall back on a hard-coded list of attributes which won't be as accurate,
33+
# Therefore, we'll fall back on a hard-coded list of attributes which won't be as accurate,
3434
# but this is not 100% accurate anyway.
3535
MANAGER_ATTRS = {
3636
"none",
@@ -837,7 +837,7 @@ def apply_augmentations(linter):
837837
is_urls_module_valid_constant,
838838
)
839839

840-
# supress errors when accessing magical class attributes
840+
# suppress errors when accessing magical class attributes
841841
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_manager_attribute)
842842
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_admin_attribute)
843843
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_model_attribute)

pylint_django/checkers/migrations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class MissingBackwardsMigrationChecker(checkers.BaseChecker):
117117
f"W{BASE_ID}97": (
118118
"Always include backwards migration callable",
119119
"missing-backwards-migration-callable",
120-
"Always include a backwards/reverse callable counterpart so that the migration is not irreversable.",
120+
"Always include a backwards/reverse callable counterpart so that the migration is not irreversible.",
121121
)
122122
}
123123

pylint_django/tests/input/external_tastypie_noerror_foreign_key.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Checks that Pylint doesn't raise an error when a 'ForeignKey' appears in a
33
non-django class
44
5-
The real case is described as follow:
5+
The real case is described as follows:
66
The project use tastypie and django.
77
tastypie has a `ForeignKey` field which has the same name
88
as django's `ForeignKey`.
9-
The issue is the lint trys resolving the `ForeignKey` for the
9+
The issue is the lint tries resolving the `ForeignKey` for the
1010
tastypie `ForeignKey` which cause import error.
1111
"""
1212
from tastypie import fields

pylint_django/tests/input/func_noerror_unicode_py2_compatible.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Ensures that no '__unicode__ missing' warning is emitted if the
3-
Django python3/2 compatability decorator is used
3+
Django python3/2 compatibility decorator is used
44
55
See https://github.com/pylint-dev/pylint-django/issues/10
66
"""

pylint_django/transforms/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
These transforms replace the Django types with adapted versions to provide
33
additional typing and method inference to pylint. All of these transforms
44
are considered "global" to pylint-django, in that all checks and improvements
5-
requre them to be loaded. Additional transforms specific to checkers are loaded
5+
require them to be loaded. Additional transforms specific to checkers are loaded
66
by the checker rather than here.
77
88
For example, the ForeignKeyStringsChecker loads the foreignkey.py transforms

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,6 @@ disable = [
9696
]
9797
ignore = "tests"
9898
max-line-length = 120
99+
100+
[tool.codespell]
101+
ignore-words = [ "custom_dict.txt" ]

0 commit comments

Comments
 (0)