Skip to content

Commit

Permalink
Add codespell in pre-commit, fix existing typo, create a custom dict (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas authored Oct 8, 2024
1 parent ce86aaa commit db23bcc
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ repos:
- id: pyproject-fmt
# https://pyproject-fmt.readthedocs.io/en/latest/#calculating-max-supported-python-version
additional_dependencies: ["tox>=4.9"]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: ["--toml=pyproject.toml"]
additional_dependencies:
- tomli
- repo: local
hooks:
- id: pylint
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ Version 2.0.4 (do not use)
Version 2.0.3 (do not use)
--------------------------

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

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

Version 0.5.3
Expand Down Expand Up @@ -578,7 +578,7 @@ Version 0.5
Improved handling of Django model fields
- `Issue #10 <https://github.com/PyCQA/pylint-django/issues/10>`__ No
warning about missing **unicode** if the Django python3/2
compatability tools are used
compatibility tools are used
- `Issue #11 <https://github.com/PyCQA/pylint-django/issues/11>`__
Improved handling of Django form fields
- `Issue #12 <https://github.com/PyCQA/pylint-django/issues/12>`__
Expand Down
1 change: 1 addition & 0 deletions custom_dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
astroid
4 changes: 2 additions & 2 deletions pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# get its attributes that way - and this used to be the method - but unfortunately
# there's no guarantee that Django is properly configured at that stage, and importing
# anything from the django.db package causes an ImproperlyConfigured exception.
# Therefore we'll fall back on a hard-coded list of attributes which won't be as accurate,
# Therefore, we'll fall back on a hard-coded list of attributes which won't be as accurate,
# but this is not 100% accurate anyway.
MANAGER_ATTRS = {
"none",
Expand Down Expand Up @@ -837,7 +837,7 @@ def apply_augmentations(linter):
is_urls_module_valid_constant,
)

# supress errors when accessing magical class attributes
# suppress errors when accessing magical class attributes
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_manager_attribute)
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_admin_attribute)
suppress_message(linter, TypeChecker.visit_attribute, "no-member", is_model_attribute)
Expand Down
2 changes: 1 addition & 1 deletion pylint_django/checkers/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class MissingBackwardsMigrationChecker(checkers.BaseChecker):
f"W{BASE_ID}97": (
"Always include backwards migration callable",
"missing-backwards-migration-callable",
"Always include a backwards/reverse callable counterpart so that the migration is not irreversable.",
"Always include a backwards/reverse callable counterpart so that the migration is not irreversible.",
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Checks that Pylint doesn't raise an error when a 'ForeignKey' appears in a
non-django class
The real case is described as follow:
The real case is described as follows:
The project use tastypie and django.
tastypie has a `ForeignKey` field which has the same name
as django's `ForeignKey`.
The issue is the lint trys resolving the `ForeignKey` for the
The issue is the lint tries resolving the `ForeignKey` for the
tastypie `ForeignKey` which cause import error.
"""
from tastypie import fields
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Ensures that no '__unicode__ missing' warning is emitted if the
Django python3/2 compatability decorator is used
Django python3/2 compatibility decorator is used
See https://github.com/pylint-dev/pylint-django/issues/10
"""
Expand Down
2 changes: 1 addition & 1 deletion pylint_django/transforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
These transforms replace the Django types with adapted versions to provide
additional typing and method inference to pylint. All of these transforms
are considered "global" to pylint-django, in that all checks and improvements
requre them to be loaded. Additional transforms specific to checkers are loaded
require them to be loaded. Additional transforms specific to checkers are loaded
by the checker rather than here.
For example, the ForeignKeyStringsChecker loads the foreignkey.py transforms
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,6 @@ disable = [
]
ignore = "tests"
max-line-length = 120

[tool.codespell]
ignore-words = [ "custom_dict.txt" ]

0 comments on commit db23bcc

Please sign in to comment.