diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b6c601c..591a18c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2516b570..22dea9cc 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -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 `_ and `#202 `_ @@ -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 @@ -578,7 +578,7 @@ Version 0.5 Improved handling of Django model fields - `Issue #10 `__ No warning about missing **unicode** if the Django python3/2 - compatability tools are used + compatibility tools are used - `Issue #11 `__ Improved handling of Django form fields - `Issue #12 `__ diff --git a/custom_dict.txt b/custom_dict.txt new file mode 100644 index 00000000..450d4fe9 --- /dev/null +++ b/custom_dict.txt @@ -0,0 +1 @@ +astroid diff --git a/pylint_django/augmentations/__init__.py b/pylint_django/augmentations/__init__.py index fcb19b35..db259647 100644 --- a/pylint_django/augmentations/__init__.py +++ b/pylint_django/augmentations/__init__.py @@ -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", @@ -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) diff --git a/pylint_django/checkers/migrations.py b/pylint_django/checkers/migrations.py index a7d1ec8d..f4addfb2 100644 --- a/pylint_django/checkers/migrations.py +++ b/pylint_django/checkers/migrations.py @@ -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.", ) } diff --git a/pylint_django/tests/input/external_tastypie_noerror_foreign_key.py b/pylint_django/tests/input/external_tastypie_noerror_foreign_key.py index 68413e9a..f83d66f2 100644 --- a/pylint_django/tests/input/external_tastypie_noerror_foreign_key.py +++ b/pylint_django/tests/input/external_tastypie_noerror_foreign_key.py @@ -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 diff --git a/pylint_django/tests/input/func_noerror_unicode_py2_compatible.py b/pylint_django/tests/input/func_noerror_unicode_py2_compatible.py index 42f2af49..2cd04d27 100644 --- a/pylint_django/tests/input/func_noerror_unicode_py2_compatible.py +++ b/pylint_django/tests/input/func_noerror_unicode_py2_compatible.py @@ -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 """ diff --git a/pylint_django/transforms/__init__.py b/pylint_django/transforms/__init__.py index e99a6fe2..2ce561d4 100644 --- a/pylint_django/transforms/__init__.py +++ b/pylint_django/transforms/__init__.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index ebe47b7a..5238b32a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,3 +96,6 @@ disable = [ ] ignore = "tests" max-line-length = 120 + +[tool.codespell] +ignore-words = [ "custom_dict.txt" ]