Repository Analysis

encode/django-rest-framework

Web APIs for Django. 🎸

17.5 Moderate AI signal View on GitHub
17.5
Adjusted Score
17.5
Raw Score
100%
Time Factor
2026-05-14
Last Push
30,040
Stars
Python
Language
64,597
Lines of Code
307
Files
997
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 7HIGH 11MEDIUM 25LOW 954

Pattern Findings

997 matches across 15 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers892 hits · 878 pts
SeverityFileLineSnippet
LOWtests/test_utils.py87 def test_resource_root_breadcrumbs(self):
LOWtests/test_utils.py93 def test_resource_instance_breadcrumbs(self):
LOWtests/test_utils.py101 def test_resource_instance_customname_breadcrumbs(self):
LOWtests/test_utils.py109 def test_nested_resource_breadcrumbs(self):
LOWtests/test_utils.py118 def test_nested_resource_instance_breadcrumbs(self):
LOWtests/test_utils.py128 def test_broken_url_breadcrumbs_handled_gracefully(self):
LOWtests/test_utils.py132 def test_modelviewset_resource_instance_breadcrumbs(self):
LOWtests/test_utils.py140 def test_modelviewset_list_action_breadcrumbs(self):
LOWtests/test_utils.py148 def test_modelviewset_detail_action_breadcrumbs(self):
LOWtests/test_utils.py157 def test_modelviewset_action_name_kwarg(self):
LOWtests/test_utils.py166 def test_modelviewset_action_suffix_kwarg(self):
LOWtests/test_utils.py207 def test_valid_unicode_preserved(self):
LOWtests/test_utils.py217 def test_valid_unicode_replaced(self):
LOWtests/test_utils.py239 def test_valid_unicode_removed(self):
LOWtests/test_utils.py258 def test_it_formats_correctly(self):
LOWtests/test_pagination.py42 def test_filtered_items_are_paginated(self):
LOWtests/test_pagination.py67 def test_setting_page_size_over_maximum(self):
LOWtests/test_pagination.py85 def test_setting_page_size_to_zero(self):
LOWtests/test_pagination.py99 def test_additional_query_params_are_preserved(self):
LOWtests/test_pagination.py110 def test_empty_query_params_are_preserved(self):
LOWtests/test_pagination.py263 def test_get_paginated_response_schema(self):
LOWtests/test_pagination.py407 def test_pagination_not_applied_if_limit_or_default_limit_not_set(self):
LOWtests/test_pagination.py575 def test_get_paginated_response_schema(self):
LOWtests/test_pagination.py619 def test_use_with_ordering_filter(self):
LOWtests/test_pagination.py637 def test_use_with_ordering_filter_without_ordering_default_value(self):
LOWtests/test_pagination.py724 def test_cursor_pagination_current_page_empty_forward(self):
LOWtests/test_pagination.py747 def test_cursor_pagination_current_page_empty_reverse(self):
LOWtests/test_pagination.py770 def test_cursor_pagination_with_page_size(self):
LOWtests/test_pagination.py782 def test_cursor_pagination_with_page_size_over_limit(self):
LOWtests/test_pagination.py794 def test_cursor_pagination_with_page_size_zero(self):
LOWtests/test_pagination.py861 def test_cursor_pagination_with_page_size_negative(self):
LOWtests/test_pagination.py928 def test_get_paginated_response_schema(self):
LOWtests/test_pagination.py1105def test_get_displayed_page_numbers():
LOWtests/test_relations_slug.py57 def test_foreign_key_retrieve(self):
LOWtests/test_relations_slug.py68 def test_foreign_key_retrieve_select_related(self):
LOWtests/test_relations_slug.py74 def test_reverse_foreign_key_retrieve(self):
LOWtests/test_relations_slug.py83 def test_reverse_foreign_key_retrieve_prefetch_related(self):
LOWtests/test_relations_slug.py107 def test_foreign_key_update_incorrect_type(self):
LOWtests/test_relations_slug.py114 def test_reverse_foreign_key_update(self):
LOWtests/test_relations_slug.py161 def test_reverse_foreign_key_create(self):
LOWtests/test_relations_slug.py179 def test_foreign_key_update_with_invalid_null(self):
LOWtests/test_relations_slug.py198 def test_foreign_key_retrieve_with_null(self):
LOWtests/test_relations_slug.py208 def test_foreign_key_create_with_valid_null(self):
LOWtests/test_relations_slug.py227 def test_foreign_key_create_with_valid_emptystring(self):
LOWtests/test_relations_slug.py251 def test_foreign_key_update_with_valid_null(self):
LOWtests/test_relations_slug.py269 def test_foreign_key_update_with_valid_emptystring(self):
LOWtests/conftest.py136def pytest_collection_modifyitems(config, items):
LOWtests/test_authtoken.py27 def test_authtoken_can_be_imported_when_not_included_in_installed_apps(self):
LOWtests/test_authtoken.py35 def test_model_admin_displayed_fields(self):
LOWtests/test_authtoken.py41 def test_model_admin__username_field(self, mock_register):
LOWtests/test_authtoken.py63 def test_token_string_representation(self):
LOWtests/test_authtoken.py66 def test_validate_raise_error_if_no_credentials_provided(self):
LOWtests/test_authtoken.py70 def test_whitespace_in_password(self):
LOWtests/test_authtoken.py76 def test_token_creation_collision_raises_integrity_error(self):
LOWtests/test_authtoken.py84 def test_key_generated_on_save_when_cleared(self):
LOWtests/test_authtoken.py97 def test_clearing_key_on_existing_token_raises_integrity_error(self):
LOWtests/test_authtoken.py109 def test_saving_existing_token_without_changes_does_not_alter_key(self):
LOWtests/test_authtoken.py122 def test_command_create_user_token(self):
LOWtests/test_authtoken.py128 def test_command_create_user_token_invalid_user(self):
LOWtests/test_authtoken.py132 def test_command_reset_user_token(self):
832 more matches not shown…
Hallucination Indicators7 hits · 70 pts
SeverityFileLineSnippet
CRITICALtests/test_fields.py15from django.core.exceptions import ValidationError as DjangoValidationError
CRITICALrest_framework/fields.py15from django.core.exceptions import ValidationError as DjangoValidationError
CRITICALrest_framework/validators.py9from django.core.exceptions import FieldError
CRITICALrest_framework/serializers.py22from django.core.exceptions import ValidationError as DjangoValidationError
CRITICALrest_framework/generics.py4from django.core.exceptions import ValidationError
CRITICALrest_framework/authtoken/admin.py5from django.core.exceptions import ValidationError
CRITICAL…framework/static/rest_framework/js/jquery-3.7.1.min.js2!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):f
Decorative Section Separators20 hits · 54 pts
SeverityFileLineSnippet
MEDIUMtests/test_model_serializer.py38# ---------------------------------
MEDIUMtests/test_model_serializer.py521# ------------------------------------
MEDIUMtests/test_serializer.py22# -------------------------------
MEDIUMtests/test_serializer.py62# -----------------------------
MEDIUMtests/test_validators.py22# ---------------------------
MEDIUMtests/test_validators.py142# -----------------------------------
MEDIUMtests/test_validators.py837# ----------------------------------
MEDIUMtests/test_validators.py906# ----------------------------------
MEDIUMtests/test_validators.py945# ----------------------------------
MEDIUMtests/test_fields.py2745# --------------------
MEDIUMtests/test_fields.py2762# --------------------
MEDIUMtests/test_fields.py33# ---------------------------
MEDIUMtests/test_fields.py128# ---------------------------------------------------------
MEDIUMtests/test_fields.py702# ----------------------------------------
MEDIUMtests/test_fields.py2777# --------------------------------
MEDIUMtests/test_fields.py2803# ---------------------
MEDIUMtests/test_fields.py2815# ---------------------------
MEDIUMrest_framework/serializers.py87# --------------
MEDIUMrest_framework/serializers.py274# -----------------------------------
MEDIUMrest_framework/serializers.py826# --------------------------------------------
Cross-File Repetition9 hits · 45 pts
SeverityFileLineSnippet
HIGHtests/test_relations_slug.py0the emptystring should be interpreted as null in the context of relationships.
HIGHtests/test_relations_slug.py0the emptystring should be interpreted as null in the context of relationships.
HIGHtests/test_relations_hyperlink.py0the emptystring should be interpreted as null in the context of relationships.
HIGHtests/test_relations_hyperlink.py0the emptystring should be interpreted as null in the context of relationships.
HIGHtests/test_relations_pk.py0the emptystring should be interpreted as null in the context of relationships.
HIGHtests/test_relations_pk.py0the emptystring should be interpreted as null in the context of relationships.
HIGHrest_framework/validators.py0if an instance is being updated, then do not include that instance itself as a uniqueness conflict.
HIGHrest_framework/validators.py0if an instance is being updated, then do not include that instance itself as a uniqueness conflict.
HIGHrest_framework/validators.py0if an instance is being updated, then do not include that instance itself as a uniqueness conflict.
Deep Nesting27 hits · 26 pts
SeverityFileLineSnippet
LOWtests/test_views.py28
LOWrest_framework/compat.py164
LOWrest_framework/compat.py174
LOWrest_framework/fields.py166
LOWrest_framework/fields.py700
LOWrest_framework/fields.py837
LOWrest_framework/fields.py1198
LOWrest_framework/fields.py1253
LOWrest_framework/fields.py1319
LOWrest_framework/serializers.py1257
LOWrest_framework/serializers.py1455
LOWrest_framework/serializers.py1472
LOWrest_framework/renderers.py179
LOWrest_framework/renderers.py558
LOWrest_framework/routers.py266
LOWrest_framework/filters.py20
LOWrest_framework/filters.py83
LOWrest_framework/filters.py111
LOWrest_framework/negotiation.py35
LOWrest_framework/templatetags/rest_framework.py182
LOWrest_framework/utils/encoders.py23
LOWrest_framework/utils/representation.py70
LOWrest_framework/schemas/openapi.py215
LOWrest_framework/schemas/openapi.py269
LOWrest_framework/schemas/openapi.py338
LOWrest_framework/schemas/openapi.py552
LOWrest_framework/schemas/generators.py72
Unused Imports15 hits · 14 pts
SeverityFileLineSnippet
LOWtests/conftest.py110
LOWtests/importable/__init__.py6
LOWrest_framework/compat.py149
LOWrest_framework/serializers.py55
LOWrest_framework/serializers.py55
LOWrest_framework/serializers.py55
LOWrest_framework/serializers.py55
LOWrest_framework/serializers.py62
LOWrest_framework/serializers.py62
LOWrest_framework/serializers.py62
LOWrest_framework/serializers.py68
LOWrest_framework/serializers.py71
LOWrest_framework/apps.py10
LOWrest_framework/schemas/__init__.py25
LOWrest_framework/schemas/__init__.py26
Self-Referential Comments5 hits · 14 pts
SeverityFileLineSnippet
MEDIUMtests/test_authtoken.py85 # Create a new user for this test to avoid conflicts with setUp token
MEDIUMtests/test_authtoken.py88 # Create a token without a key - it should generate one automatically
MEDIUMtests/test_model_serializer.py859 # Creating the instance, relationship attributes should be set.
MEDIUMtests/test_model_serializer.py907 # Creating the instance, relationship attributes should be set.
MEDIUMrest_framework/serializers.py1141 # Create the serializer field.
Excessive Try-Catch Wrapping9 hits · 9 pts
SeverityFileLineSnippet
LOWtests/test_urlpatterns.py27 except Exception:
LOWtests/test_urlpatterns.py43 except Exception:
LOWrest_framework/fields.py1187 except Exception as e:
LOWrest_framework/request.py360 except Exception:
LOWrest_framework/renderers.py199 except Exception:
LOWrest_framework/views.py317 except Exception:
LOWrest_framework/views.py514 except Exception as exc:
LOWrest_framework/utils/breadcrumbs.py19 except Exception:
LOWrest_framework/schemas/openapi.py284 except Exception:
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippet
HIGHtests/test_fields.py2729 (b'{"a": 1, "3": null, "b": ["some", "list", true, 1.23]}', {
Synthetic Comment Markers1 hit · 5 pts
SeverityFileLineSnippet
HIGHdocs/tutorial/2-requests-and-responses.md20return Response(data) # Renders to content type as requested by the client.
Fake / Example Data5 hits · 4 pts
SeverityFileLineSnippet
LOWREADME.md132 "email": "admin@example.com",
LOWtests/schemas/test_openapi.py1065 assert properties['email']['default'] == 'foo@bar.com'
LOWtests/schemas/views.py131 email = serializers.EmailField(default='foo@bar.com')
LOWdocs/tutorial/quickstart.md229 "email": "admin@example.com",
LOWdocs/tutorial/quickstart.md249 "email": "admin@example.com",
Redundant / Tautological Comments3 hits · 4 pts
SeverityFileLineSnippet
LOWrest_framework/settings.py222 # Check if present in user settings
LOWrest_framework/decorators.py94 # Check if func is actually a view function (result of APIView.as_view())
LOWrest_framework/utils/breadcrumbs.py22 # Check if this is a REST framework view,
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippet
LOWrest_framework/serializers.py1643 # Note that we make sure to check `unique_together` both on the
Over-Commented Block1 hit · 1 pts
SeverityFileLineSnippet
LOWrest_framework/serializers.py881 # ...
Overly Generic Function Names1 hit · 0 pts
SeverityFileLineSnippet
LOWtests/test_fields.py70 def test_function(self):