Repository Analysis

encode/django-rest-framework

Web APIs for Django. 🎸

17.1 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of encode/django-rest-framework, a Python project with 30,149 GitHub stars. SynthScan v2.0 examined 65,745 lines of code across 307 source files, recording 1024 pattern matches distributed across 16 syntactic categories. The overall adjusted score of 17.1 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).

17.1
Adjusted Score
17.1
Raw Score
100%
Time Factor
2026-08-25
Last Push
30.1K
Stars
Python
Language
65.7K
Lines of Code
307
Files
1.0K
Pattern Hits
2026-08-29
Scan Date
0.04
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

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.

Severity Breakdown

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.

CRITICAL 7HIGH 5MEDIUM 28LOW 984

Directory Score Breakdown

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.

Pattern Findings

The scanner identified 1024 distinct pattern matches across 16 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.

Hyper-Verbose Identifiers921 hits · 894 pts
SeverityFileLineSnippetContext
LOWtests/test_utils.py87 def test_resource_root_breadcrumbs(self):CODE
LOWtests/test_utils.py93 def test_resource_instance_breadcrumbs(self):CODE
LOWtests/test_utils.py101 def test_resource_instance_customname_breadcrumbs(self):CODE
LOWtests/test_utils.py109 def test_nested_resource_breadcrumbs(self):CODE
LOWtests/test_utils.py118 def test_nested_resource_instance_breadcrumbs(self):CODE
LOWtests/test_utils.py128 def test_broken_url_breadcrumbs_handled_gracefully(self):CODE
LOWtests/test_utils.py132 def test_modelviewset_resource_instance_breadcrumbs(self):CODE
LOWtests/test_utils.py140 def test_modelviewset_list_action_breadcrumbs(self):CODE
LOWtests/test_utils.py148 def test_modelviewset_detail_action_breadcrumbs(self):CODE
LOWtests/test_utils.py157 def test_modelviewset_action_name_kwarg(self):CODE
LOWtests/test_utils.py166 def test_modelviewset_action_suffix_kwarg(self):CODE
LOWtests/test_utils.py207 def test_valid_unicode_preserved(self):CODE
LOWtests/test_utils.py217 def test_valid_unicode_replaced(self):CODE
LOWtests/test_utils.py239 def test_valid_unicode_removed(self):CODE
LOWtests/test_utils.py258 def test_it_formats_correctly(self):CODE
LOWtests/test_pagination.py42 def test_filtered_items_are_paginated(self):CODE
LOWtests/test_pagination.py67 def test_setting_page_size_over_maximum(self):CODE
LOWtests/test_pagination.py85 def test_setting_page_size_to_zero(self):CODE
LOWtests/test_pagination.py99 def test_additional_query_params_are_preserved(self):CODE
LOWtests/test_pagination.py110 def test_empty_query_params_are_preserved(self):CODE
LOWtests/test_pagination.py263 def test_get_paginated_response_schema(self):CODE
LOWtests/test_pagination.py407 def test_pagination_not_applied_if_limit_or_default_limit_not_set(self):CODE
LOWtests/test_pagination.py575 def test_get_paginated_response_schema(self):CODE
LOWtests/test_pagination.py619 def test_use_with_ordering_filter(self):CODE
LOWtests/test_pagination.py637 def test_use_with_ordering_filter_without_ordering_default_value(self):CODE
LOWtests/test_pagination.py724 def test_cursor_pagination_current_page_empty_forward(self):CODE
LOWtests/test_pagination.py747 def test_cursor_pagination_current_page_empty_reverse(self):CODE
LOWtests/test_pagination.py770 def test_cursor_pagination_with_page_size(self):CODE
LOWtests/test_pagination.py782 def test_cursor_pagination_with_page_size_over_limit(self):CODE
LOWtests/test_pagination.py794 def test_cursor_pagination_with_page_size_zero(self):CODE
LOWtests/test_pagination.py861 def test_cursor_pagination_with_page_size_negative(self):CODE
LOWtests/test_pagination.py928 def test_get_paginated_response_schema(self):CODE
LOWtests/test_pagination.py1105def test_get_displayed_page_numbers():CODE
LOWtests/test_relations_slug.py57 def test_foreign_key_retrieve(self):CODE
LOWtests/test_relations_slug.py68 def test_foreign_key_retrieve_select_related(self):CODE
LOWtests/test_relations_slug.py74 def test_reverse_foreign_key_retrieve(self):CODE
LOWtests/test_relations_slug.py83 def test_reverse_foreign_key_retrieve_prefetch_related(self):CODE
LOWtests/test_relations_slug.py107 def test_foreign_key_update_incorrect_type(self):CODE
LOWtests/test_relations_slug.py114 def test_reverse_foreign_key_update(self):CODE
LOWtests/test_relations_slug.py161 def test_reverse_foreign_key_create(self):CODE
LOWtests/test_relations_slug.py179 def test_foreign_key_update_with_invalid_null(self):CODE
LOWtests/test_relations_slug.py198 def test_foreign_key_retrieve_with_null(self):CODE
LOWtests/test_relations_slug.py208 def test_foreign_key_create_with_valid_null(self):CODE
LOWtests/test_relations_slug.py227 def test_foreign_key_create_with_valid_emptystring(self):CODE
LOWtests/test_relations_slug.py251 def test_foreign_key_update_with_valid_null(self):CODE
LOWtests/test_relations_slug.py269 def test_foreign_key_update_with_valid_emptystring(self):CODE
LOWtests/conftest.py137def pytest_collection_modifyitems(config, items):CODE
LOWtests/test_authtoken.py27 def test_authtoken_can_be_imported_when_not_included_in_installed_apps(self):CODE
LOWtests/test_authtoken.py35 def test_model_admin_displayed_fields(self):CODE
LOWtests/test_authtoken.py41 def test_model_admin__username_field(self, mock_register):CODE
LOWtests/test_authtoken.py63 def test_token_string_representation(self):CODE
LOWtests/test_authtoken.py66 def test_validate_raise_error_if_no_credentials_provided(self):CODE
LOWtests/test_authtoken.py70 def test_whitespace_in_password(self):CODE
LOWtests/test_authtoken.py76 def test_token_creation_collision_raises_integrity_error(self):CODE
LOWtests/test_authtoken.py84 def test_key_generated_on_save_when_cleared(self):CODE
LOWtests/test_authtoken.py97 def test_clearing_key_on_existing_token_raises_integrity_error(self):CODE
LOWtests/test_authtoken.py109 def test_saving_existing_token_without_changes_does_not_alter_key(self):CODE
LOWtests/test_authtoken.py122 def test_command_create_user_token(self):CODE
LOWtests/test_authtoken.py128 def test_command_create_user_token_invalid_user(self):CODE
LOWtests/test_authtoken.py132 def test_command_reset_user_token(self):CODE
861 more matches not shown…
Hallucination Indicators7 hits · 70 pts
SeverityFileLineSnippetContext
CRITICALtests/test_fields.py13from django.core.exceptions import ValidationError as DjangoValidationErrorCODE
CRITICALrest_framework/fields.py15from django.core.exceptions import ValidationError as DjangoValidationErrorCODE
CRITICALrest_framework/validators.py9from django.core.exceptions import FieldErrorCODE
CRITICALrest_framework/serializers.py22from django.core.exceptions import ValidationError as DjangoValidationErrorCODE
CRITICALrest_framework/generics.py4from django.core.exceptions import ValidationErrorCODE
CRITICALrest_framework/authtoken/admin.py5from django.core.exceptions import ValidationErrorCODE
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):fCODE
Decorative Section Separators21 hits · 54 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_model_serializer.py39# ---------------------------------COMMENT
MEDIUMtests/test_model_serializer.py603# ------------------------------------STRING
MEDIUMtests/test_serializer.py22# -------------------------------COMMENT
MEDIUMtests/test_serializer.py62# -----------------------------COMMENT
MEDIUMtests/test_validators.py22# ---------------------------COMMENT
MEDIUMtests/test_validators.py142# -----------------------------------STRING
MEDIUMtests/test_validators.py882# ----------------------------------STRING
MEDIUMtests/test_validators.py951# ----------------------------------STRING
MEDIUMtests/test_validators.py990# ----------------------------------STRING
MEDIUMtests/test_validators.py1117# ---------------------------------STRING
MEDIUMtests/test_fields.py2788# --------------------COMMENT
MEDIUMtests/test_fields.py2805# --------------------COMMENT
MEDIUMtests/test_fields.py31# ---------------------------COMMENT
MEDIUMtests/test_fields.py126# ---------------------------------------------------------COMMENT
MEDIUMtests/test_fields.py700# ----------------------------------------COMMENT
MEDIUMtests/test_fields.py2820# --------------------------------COMMENT
MEDIUMtests/test_fields.py2846# ---------------------COMMENT
MEDIUMtests/test_fields.py2858# ---------------------------COMMENT
MEDIUMrest_framework/serializers.py85# --------------COMMENT
MEDIUMrest_framework/serializers.py272# -----------------------------------COMMENT
MEDIUMrest_framework/serializers.py823# --------------------------------------------COMMENT
Deep Nesting26 hits · 24 pts
SeverityFileLineSnippetContext
LOWtests/test_views.py27CODE
LOWrest_framework/fields.py160CODE
LOWrest_framework/fields.py694CODE
LOWrest_framework/fields.py832CODE
LOWrest_framework/fields.py1188CODE
LOWrest_framework/fields.py1243CODE
LOWrest_framework/fields.py1309CODE
LOWrest_framework/serializers.py1254CODE
LOWrest_framework/serializers.py1452CODE
LOWrest_framework/serializers.py1475CODE
LOWrest_framework/renderers.py179CODE
LOWrest_framework/renderers.py558CODE
LOWrest_framework/renderers.py778CODE
LOWrest_framework/routers.py266CODE
LOWrest_framework/filters.py20CODE
LOWrest_framework/filters.py84CODE
LOWrest_framework/filters.py112CODE
LOWrest_framework/negotiation.py35CODE
LOWrest_framework/templatetags/rest_framework.py182CODE
LOWrest_framework/utils/encoders.py23CODE
LOWrest_framework/utils/representation.py70CODE
LOWrest_framework/schemas/openapi.py215CODE
LOWrest_framework/schemas/openapi.py269CODE
LOWrest_framework/schemas/openapi.py338CODE
LOWrest_framework/schemas/openapi.py552CODE
LOWrest_framework/schemas/generators.py72CODE
Cross-File Repetition3 hits · 15 pts
SeverityFileLineSnippetContext
HIGHtests/test_relations_slug.py0the emptystring should be interpreted as null in the context of relationships.STRING
HIGHtests/test_relations_hyperlink.py0the emptystring should be interpreted as null in the context of relationships.STRING
HIGHtests/test_relations_pk.py0the emptystring should be interpreted as null in the context of relationships.STRING
Unused Imports15 hits · 14 pts
SeverityFileLineSnippetContext
LOWtests/conftest.py111CODE
LOWtests/importable/__init__.py6CODE
LOWrest_framework/compat.py145CODE
LOWrest_framework/serializers.py53CODE
LOWrest_framework/serializers.py53CODE
LOWrest_framework/serializers.py53CODE
LOWrest_framework/serializers.py53CODE
LOWrest_framework/serializers.py60CODE
LOWrest_framework/serializers.py60CODE
LOWrest_framework/serializers.py60CODE
LOWrest_framework/serializers.py66CODE
LOWrest_framework/serializers.py69CODE
LOWrest_framework/apps.py10CODE
LOWrest_framework/schemas/__init__.py25CODE
LOWrest_framework/schemas/__init__.py26CODE
Self-Referential Comments5 hits · 14 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_authtoken.py85 # Create a new user for this test to avoid conflicts with setUp tokenCOMMENT
MEDIUMtests/test_authtoken.py88 # Create a token without a key - it should generate one automaticallyCOMMENT
MEDIUMtests/test_model_serializer.py941 # Creating the instance, relationship attributes should be set.STRING
MEDIUMtests/test_model_serializer.py989 # Creating the instance, relationship attributes should be set.STRING
MEDIUMrest_framework/serializers.py1138 # Create the serializer field.COMMENT
Excessive Try-Catch Wrapping8 hits · 8 pts
SeverityFileLineSnippetContext
LOWtests/test_urlpatterns.py27 except Exception:CODE
LOWtests/test_urlpatterns.py43 except Exception:CODE
LOWrest_framework/request.py364 except Exception:CODE
LOWrest_framework/renderers.py199 except Exception:CODE
LOWrest_framework/views.py316 except Exception:CODE
LOWrest_framework/views.py525 except Exception as exc:CODE
LOWrest_framework/utils/breadcrumbs.py19 except Exception:CODE
LOWrest_framework/schemas/openapi.py284 except Exception:CODE
Fake / Example Data7 hits · 6 pts
SeverityFileLineSnippetContext
LOWREADME.md132 "email": "admin@example.com",CODE
LOWtests/schemas/test_openapi.py1073 assert properties['email']['default'] == 'foo@bar.com'CODE
LOWtests/schemas/views.py131 email = serializers.EmailField(default='foo@bar.com')CODE
LOWdocs/tutorial/quickstart.md229 "email": "admin@example.com",CODE
LOWdocs/tutorial/quickstart.md249 "email": "admin@example.com",CODE
LOWdocs/topics/html-and-forms.md111 style={'placeholder': 'Email', 'autofocus': True}CODE
LOWdocs/topics/html-and-forms.md115 style={'input_type': 'password', 'placeholder': 'Password'}CODE
Modern AI Meta-Vocabulary2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMrest_framework/relations.py291 # We include this simply for dependency injection in tests.COMMENT
MEDIUMrest_framework/views.py117 # Allow dependency injection of other settings to make testing easier.COMMENT
Cross-Language Confusion1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHtests/test_fields.py2772 (b'{"a": 1, "3": null, "b": ["some", "list", true, 1.23]}', {CODE
Synthetic Comment Markers1 hit · 5 pts
SeverityFileLineSnippetContext
HIGHdocs/tutorial/2-requests-and-responses.md20return Response(data) # Renders to content type as requested by the client.CODE
Redundant / Tautological Comments3 hits · 4 pts
SeverityFileLineSnippetContext
LOWrest_framework/settings.py222 # Check if present in user settingsCOMMENT
LOWrest_framework/decorators.py97 # Check if func is actually a view function (result of APIView.as_view())COMMENT
LOWrest_framework/utils/breadcrumbs.py22 # Check if this is a REST framework view,COMMENT
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWrest_framework/fields.py293CODE
LOWrest_framework/schemas/__init__.py29CODE
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippetContext
LOWrest_framework/serializers.py1646 # Note that we make sure to check `unique_together` both on theCOMMENT
Overly Generic Function Names1 hit · 0 pts
SeverityFileLineSnippetContext
LOWtests/test_fields.py68 def test_function(self):CODE