Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > pylint_django > checkers
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
__pycache__ | Directory | - | - | |
__init__.py | File | 802 bytes | April 17 2025 13:10:59. | |
auth_user.py | File | 1392 bytes | April 17 2025 13:10:59. | |
django_installed.py | File | 1319 bytes | April 17 2025 13:10:59. | |
foreign_key_strings.py | File | 6321 bytes | April 17 2025 13:10:59. | |
forms.py | File | 1517 bytes | April 17 2025 13:10:59. | |
json_response.py | File | 2701 bytes | April 17 2025 13:10:59. | |
migrations.py | File | 6428 bytes | April 17 2025 13:10:59. | |
models.py | File | 4609 bytes | April 17 2025 13:10:59. |
from pylint import checkers, interfaces from pylint.checkers import utils from pylint_django.__pkginfo__ import BASE_ID class AuthUserChecker(checkers.BaseChecker): __implements__ = (interfaces.IAstroidChecker,) name = "auth-user-checker" msgs = { f"E{BASE_ID}41": ( "Hard-coded 'auth.User'", "hard-coded-auth-user", "Don't hard-code the auth.User model. Use settings.AUTH_USER_MODEL instead!", ), f"E{BASE_ID}42": ( "User model imported from django.contrib.auth.models", "imported-auth-user", "Don't import django.contrib.auth.models.User model. Use django.contrib.auth.get_user_model() instead!", ), } @utils.check_messages("hard-coded-auth-user") def visit_const(self, node): # for now we don't check if the parent is a ForeignKey field # because the user model should not be hard-coded anywhere if node.value == "auth.User": self.add_message("hard-coded-auth-user", node=node) @utils.check_messages("imported-auth-user") def visit_importfrom(self, node): if node.modname == "django.contrib.auth.models": for imported_names in node.names: if imported_names[0] in ["*", "User"]: self.add_message("imported-auth-user", node=node) break
SILENT KILLER Tool