Web APIs for Django. 🎸
This report presents the forensic synthetic code analysis of encode/django-rest-framework, a Python project with 30,100 GitHub stars. SynthScan v2.0 examined 64,667 lines of code across 307 source files, recording 1001 pattern matches distributed across 17 syntactic categories. The overall adjusted score of 17.2 places this repository in the Moderate AI signal band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 1001 distinct pattern matches across 17 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | tests/test_utils.py | 87 | def test_resource_root_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 93 | def test_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 101 | def test_resource_instance_customname_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 109 | def test_nested_resource_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 118 | def test_nested_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 128 | def test_broken_url_breadcrumbs_handled_gracefully(self): | CODE |
| LOW⚡ | tests/test_utils.py | 132 | def test_modelviewset_resource_instance_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 140 | def test_modelviewset_list_action_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 148 | def test_modelviewset_detail_action_breadcrumbs(self): | CODE |
| LOW⚡ | tests/test_utils.py | 157 | def test_modelviewset_action_name_kwarg(self): | CODE |
| LOW⚡ | tests/test_utils.py | 166 | def test_modelviewset_action_suffix_kwarg(self): | CODE |
| LOW | tests/test_utils.py | 207 | def test_valid_unicode_preserved(self): | CODE |
| LOW | tests/test_utils.py | 217 | def test_valid_unicode_replaced(self): | CODE |
| LOW | tests/test_utils.py | 239 | def test_valid_unicode_removed(self): | CODE |
| LOW | tests/test_utils.py | 258 | def test_it_formats_correctly(self): | CODE |
| LOW | tests/test_pagination.py | 42 | def test_filtered_items_are_paginated(self): | CODE |
| LOW | tests/test_pagination.py | 67 | def test_setting_page_size_over_maximum(self): | CODE |
| LOW | tests/test_pagination.py | 85 | def test_setting_page_size_to_zero(self): | CODE |
| LOW | tests/test_pagination.py | 99 | def test_additional_query_params_are_preserved(self): | CODE |
| LOW | tests/test_pagination.py | 110 | def test_empty_query_params_are_preserved(self): | CODE |
| LOW | tests/test_pagination.py | 263 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 407 | def test_pagination_not_applied_if_limit_or_default_limit_not_set(self): | CODE |
| LOW | tests/test_pagination.py | 575 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 619 | def test_use_with_ordering_filter(self): | CODE |
| LOW | tests/test_pagination.py | 637 | def test_use_with_ordering_filter_without_ordering_default_value(self): | CODE |
| LOW | tests/test_pagination.py | 724 | def test_cursor_pagination_current_page_empty_forward(self): | CODE |
| LOW | tests/test_pagination.py | 747 | def test_cursor_pagination_current_page_empty_reverse(self): | CODE |
| LOW | tests/test_pagination.py | 770 | def test_cursor_pagination_with_page_size(self): | CODE |
| LOW | tests/test_pagination.py | 782 | def test_cursor_pagination_with_page_size_over_limit(self): | CODE |
| LOW | tests/test_pagination.py | 794 | def test_cursor_pagination_with_page_size_zero(self): | CODE |
| LOW | tests/test_pagination.py | 861 | def test_cursor_pagination_with_page_size_negative(self): | CODE |
| LOW | tests/test_pagination.py | 928 | def test_get_paginated_response_schema(self): | CODE |
| LOW | tests/test_pagination.py | 1105 | def test_get_displayed_page_numbers(): | CODE |
| LOW | tests/test_relations_slug.py | 57 | def test_foreign_key_retrieve(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 68 | def test_foreign_key_retrieve_select_related(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 74 | def test_reverse_foreign_key_retrieve(self): | CODE |
| LOW⚡ | tests/test_relations_slug.py | 83 | def test_reverse_foreign_key_retrieve_prefetch_related(self): | CODE |
| LOW | tests/test_relations_slug.py | 107 | def test_foreign_key_update_incorrect_type(self): | CODE |
| LOW | tests/test_relations_slug.py | 114 | def test_reverse_foreign_key_update(self): | CODE |
| LOW | tests/test_relations_slug.py | 161 | def test_reverse_foreign_key_create(self): | CODE |
| LOW | tests/test_relations_slug.py | 179 | def test_foreign_key_update_with_invalid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 198 | def test_foreign_key_retrieve_with_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 208 | def test_foreign_key_create_with_valid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 227 | def test_foreign_key_create_with_valid_emptystring(self): | CODE |
| LOW | tests/test_relations_slug.py | 251 | def test_foreign_key_update_with_valid_null(self): | CODE |
| LOW | tests/test_relations_slug.py | 269 | def test_foreign_key_update_with_valid_emptystring(self): | CODE |
| LOW | tests/conftest.py | 136 | def pytest_collection_modifyitems(config, items): | CODE |
| LOW⚡ | tests/test_authtoken.py | 27 | def test_authtoken_can_be_imported_when_not_included_in_installed_apps(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 35 | def test_model_admin_displayed_fields(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 41 | def test_model_admin__username_field(self, mock_register): | CODE |
| LOW⚡ | tests/test_authtoken.py | 63 | def test_token_string_representation(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 66 | def test_validate_raise_error_if_no_credentials_provided(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 70 | def test_whitespace_in_password(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 76 | def test_token_creation_collision_raises_integrity_error(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 84 | def test_key_generated_on_save_when_cleared(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 97 | def test_clearing_key_on_existing_token_raises_integrity_error(self): | CODE |
| LOW | tests/test_authtoken.py | 109 | def test_saving_existing_token_without_changes_does_not_alter_key(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 122 | def test_command_create_user_token(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 128 | def test_command_create_user_token_invalid_user(self): | CODE |
| LOW⚡ | tests/test_authtoken.py | 132 | def test_command_reset_user_token(self): | CODE |
| 835 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| CRITICAL | tests/test_fields.py | 15 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/fields.py | 15 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/validators.py | 9 | from django.core.exceptions import FieldError | CODE |
| CRITICAL | rest_framework/serializers.py | 22 | from django.core.exceptions import ValidationError as DjangoValidationError | CODE |
| CRITICAL | rest_framework/generics.py | 4 | from django.core.exceptions import ValidationError | CODE |
| CRITICAL | rest_framework/authtoken/admin.py | 5 | from django.core.exceptions import ValidationError | CODE |
| CRITICAL | …framework/static/rest_framework/js/jquery-3.7.1.min.js | 2 | !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):f | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | tests/test_model_serializer.py | 38 | # --------------------------------- | COMMENT |
| MEDIUM | tests/test_model_serializer.py | 521 | # ------------------------------------ | STRING |
| MEDIUM | tests/test_serializer.py | 22 | # ------------------------------- | COMMENT |
| MEDIUM | tests/test_serializer.py | 62 | # ----------------------------- | COMMENT |
| MEDIUM | tests/test_validators.py | 22 | # --------------------------- | COMMENT |
| MEDIUM⚡ | tests/test_validators.py | 142 | # ----------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 837 | # ---------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 906 | # ---------------------------------- | STRING |
| MEDIUM | tests/test_validators.py | 945 | # ---------------------------------- | STRING |
| MEDIUM⚡ | tests/test_fields.py | 2750 | # -------------------- | COMMENT |
| MEDIUM⚡ | tests/test_fields.py | 2767 | # -------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 33 | # --------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 128 | # --------------------------------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 702 | # ---------------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2782 | # -------------------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2808 | # --------------------- | COMMENT |
| MEDIUM | tests/test_fields.py | 2820 | # --------------------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 87 | # -------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 274 | # ----------------------------------- | COMMENT |
| MEDIUM | rest_framework/serializers.py | 826 | # -------------------------------------------- | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_views.py | 29 | CODE | |
| LOW | rest_framework/compat.py | 164 | CODE | |
| LOW | rest_framework/compat.py | 174 | CODE | |
| LOW | rest_framework/fields.py | 166 | CODE | |
| LOW | rest_framework/fields.py | 700 | CODE | |
| LOW | rest_framework/fields.py | 838 | CODE | |
| LOW | rest_framework/fields.py | 1199 | CODE | |
| LOW | rest_framework/fields.py | 1254 | CODE | |
| LOW | rest_framework/fields.py | 1320 | CODE | |
| LOW | rest_framework/serializers.py | 1257 | CODE | |
| LOW | rest_framework/serializers.py | 1455 | CODE | |
| LOW | rest_framework/serializers.py | 1472 | CODE | |
| LOW | rest_framework/renderers.py | 179 | CODE | |
| LOW | rest_framework/renderers.py | 558 | CODE | |
| LOW | rest_framework/routers.py | 266 | CODE | |
| LOW | rest_framework/filters.py | 20 | CODE | |
| LOW | rest_framework/filters.py | 83 | CODE | |
| LOW | rest_framework/filters.py | 111 | CODE | |
| LOW | rest_framework/negotiation.py | 35 | CODE | |
| LOW | rest_framework/templatetags/rest_framework.py | 182 | CODE | |
| LOW | rest_framework/utils/encoders.py | 23 | CODE | |
| LOW | rest_framework/utils/representation.py | 70 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 215 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 269 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 338 | CODE | |
| LOW | rest_framework/schemas/openapi.py | 552 | CODE | |
| LOW | rest_framework/schemas/generators.py | 72 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/conftest.py | 110 | CODE | |
| LOW | tests/importable/__init__.py | 6 | CODE | |
| LOW | rest_framework/compat.py | 149 | CODE | |
| LOW | rest_framework/compat.py | 196 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 55 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 62 | CODE | |
| LOW | rest_framework/serializers.py | 68 | CODE | |
| LOW | rest_framework/serializers.py | 71 | CODE | |
| LOW | rest_framework/apps.py | 10 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 25 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 26 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/test_relations_slug.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| HIGH | tests/test_relations_hyperlink.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| HIGH | tests/test_relations_pk.py | 0 | the emptystring should be interpreted as null in the context of relationships. | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM⚡ | tests/test_authtoken.py | 85 | # Create a new user for this test to avoid conflicts with setUp token | COMMENT |
| MEDIUM⚡ | tests/test_authtoken.py | 88 | # Create a token without a key - it should generate one automatically | COMMENT |
| MEDIUM | tests/test_model_serializer.py | 859 | # Creating the instance, relationship attributes should be set. | STRING |
| MEDIUM | tests/test_model_serializer.py | 907 | # Creating the instance, relationship attributes should be set. | STRING |
| MEDIUM | rest_framework/serializers.py | 1141 | # Create the serializer field. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_urlpatterns.py | 27 | except Exception: | CODE |
| LOW | tests/test_urlpatterns.py | 43 | except Exception: | CODE |
| LOW | rest_framework/fields.py | 1188 | except Exception as e: | CODE |
| LOW | rest_framework/request.py | 360 | except Exception: | CODE |
| LOW | rest_framework/renderers.py | 199 | except Exception: | CODE |
| LOW | rest_framework/views.py | 318 | except Exception: | CODE |
| LOW | rest_framework/views.py | 515 | except Exception as exc: | CODE |
| LOW | rest_framework/utils/breadcrumbs.py | 19 | except Exception: | CODE |
| LOW | rest_framework/schemas/openapi.py | 284 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | README.md | 132 | "email": "admin@example.com", | CODE |
| LOW | tests/schemas/test_openapi.py | 1073 | assert properties['email']['default'] == 'foo@bar.com' | CODE |
| LOW | tests/schemas/views.py | 131 | email = serializers.EmailField(default='foo@bar.com') | CODE |
| LOW | docs/tutorial/quickstart.md | 229 | "email": "admin@example.com", | CODE |
| LOW | docs/tutorial/quickstart.md | 249 | "email": "admin@example.com", | CODE |
| LOW | docs/topics/html-and-forms.md | 111 | style={'placeholder': 'Email', 'autofocus': True} | CODE |
| LOW | docs/topics/html-and-forms.md | 115 | style={'input_type': 'password', 'placeholder': 'Password'} | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | rest_framework/relations.py | 291 | # We include this simply for dependency injection in tests. | COMMENT |
| MEDIUM | rest_framework/views.py | 118 | # Allow dependency injection of other settings to make testing easier. | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/test_fields.py | 2734 | (b'{"a": 1, "3": null, "b": ["some", "list", true, 1.23]}', { | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | docs/tutorial/2-requests-and-responses.md | 20 | return Response(data) # Renders to content type as requested by the client. | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/settings.py | 222 | # Check if present in user settings | COMMENT |
| LOW | rest_framework/decorators.py | 94 | # Check if func is actually a view function (result of APIView.as_view()) | COMMENT |
| LOW | rest_framework/utils/breadcrumbs.py | 22 | # Check if this is a REST framework view, | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/fields.py | 299 | CODE | |
| LOW | rest_framework/schemas/__init__.py | 29 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/serializers.py | 1643 | # Note that we make sure to check `unique_together` both on the | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | rest_framework/serializers.py | 881 | # ... | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_fields.py | 70 | def test_function(self): | CODE |