diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 07160217..ff990eb9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -20,3 +20,4 @@ * [naquiroz](https://github.com/naquiroz) * [john-sandall](https://github.com/john-sandall) * [dineshtrivedi](https://github.com/dineshtrivedi) +* [jhhayashi](https://github.com/jhhayashi) diff --git a/README.rst b/README.rst index fdd06bb0..56c92b4e 100644 --- a/README.rst +++ b/README.rst @@ -106,7 +106,7 @@ This plugin is disabled by default! To enable it:: Contributing ------------ -Please feel free to add your name to the ``CONTRIBUTORS.rst`` file if you want to +Please feel free to add your name to the ``CONTRIBUTORS.md`` file if you want to be credited when pull requests get merged. You can also add to the ``CHANGELOG.rst`` file if you wish, although we'll also do that when merging. diff --git a/pylint_django/augmentations/__init__.py b/pylint_django/augmentations/__init__.py index e067709d..6ed5c496 100644 --- a/pylint_django/augmentations/__init__.py +++ b/pylint_django/augmentations/__init__.py @@ -895,6 +895,14 @@ def apply_augmentations(linter): IsClass("django.views.generic.edit.ProcessFormView"), ) + # ModelViewSet also suffers from too many ancestors + suppress_message( + linter, + MisdesignChecker.visit_classdef, + "too-many-ancestors", + IsClass("rest_framework.viewsets.ModelViewSet"), + ) + # model forms have no __init__ method anywhere in their bases suppress_message( linter, diff --git a/pylint_django/tests/input/external_drf_noerror_modelviewset.py b/pylint_django/tests/input/external_drf_noerror_modelviewset.py new file mode 100644 index 00000000..5437c542 --- /dev/null +++ b/pylint_django/tests/input/external_drf_noerror_modelviewset.py @@ -0,0 +1,10 @@ +""" +Checks that Pylint does not complain about DRF viewsets +""" +# pylint: disable=C0111,W5101,use-symbolic-message-instead,import-error,too-few-public-methods + +from rest_framework import viewsets + + +class TestModelViewsetSubclass(viewsets.ModelViewset): + pass diff --git a/setup.py b/setup.py index 4434ffd2..dfb61127 100644 --- a/setup.py +++ b/setup.py @@ -24,13 +24,14 @@ extras_require={ "with_django": ["Django"], "for_tests": [ + "coverage", "django_tables2", + "django-tastypie", + "djangorestframework", "factory-boy", - "coverage", + "pylint>=2.13", "pytest", "wheel", - "django-tastypie", - "pylint>=2.13", ], }, license="GPLv2",