Repository Analysis

django-commons/django-debug-toolbar

A configurable set of panels that display various debug information about the current request/response.

15.0 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of django-commons/django-debug-toolbar, a Python project with 8,375 GitHub stars. SynthScan v2.0 examined 18,926 lines of code across 178 source files, recording 234 pattern matches distributed across 10 syntactic categories. The overall adjusted score of 15.0 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).

15.0
Adjusted Score
15.0
Raw Score
100%
Time Factor
2026-07-13
Last Push
8.4K
Stars
Python
Language
18.9K
Lines of Code
178
Files
234
Pattern Hits
2026-07-14
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 2HIGH 6MEDIUM 3LOW 223

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 234 distinct pattern matches across 10 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 Identifiers183 hits · 184 pts
SeverityFileLineSnippetContext
LOWtests/test_integration_async.py125 async def test_include_package_urls(self):CODE
LOWtests/test_integration_async.py135 async def test_low_level_cache_view(self):CODE
LOWtests/test_integration_async.py142 async def test_cache_disable_instrumentation(self):CODE
LOWtests/test_integration_async.py165 async def test_is_toolbar_request_without_djdt_urls(self):CODE
LOWtests/test_integration_async.py174 async def test_is_toolbar_request_override_request_urlconf(self):CODE
LOWtests/test_integration_async.py183 async def test_is_toolbar_request_with_script_prefix(self):CODE
LOWtests/test_integration_async.py98 async def test_middleware_response_insertion(self):CODE
LOWtests/test_integration_async.py106 async def test_middleware_no_injection_when_encoded(self):CODE
LOWtests/test_integration_async.py235 async def test_middleware_in_async_mode(self):CODE
LOWtests/test_integration_async.py265 async def test_render_panel_checks_show_toolbar(self):CODE
LOWtests/test_integration_async.py280 async def test_middleware_render_toolbar_json(self):CODE
LOWtests/test_integration_async.py300 async def test_template_source_checks_show_toolbar(self):CODE
LOWtests/test_integration_async.py314 async def test_template_source_errors(self):CODE
LOWtests/test_integration_async.py334 async def test_sql_select_checks_show_toolbar(self):CODE
LOWtests/test_integration_async.py358 async def test_sql_explain_checks_show_toolbar(self):CODE
LOWtests/test_integration_async.py385 async def test_sql_explain_postgres_union_query(self):CODE
LOWtests/test_integration_async.py412 async def test_sql_explain_postgres_json_field(self):CODE
LOWtests/test_integration_async.py435 async def test_sql_profile_checks_show_toolbar(self):CODE
LOWtests/test_integration_async.py460 async def test_render_panels_in_request(self):CODE
LOWtests/test_integration_async.py499 async def test_view_returns_template_response(self):CODE
LOWtests/test_integration_async.py510 async def test_server_timing_headers(self):CODE
LOWtests/test_integration_async.py533 async def test_auth_login_view_without_redirect(self):CODE
LOWtests/test_utils.py71 def test_get_stack_trace_skip(self):CODE
LOWtests/test_utils.py84 def test_deprecated_functions(self):CODE
LOWtests/test_utils.py135 def test_querydict_sanitization(self):CODE
LOWtests/test_utils.py147 def test_non_sortable_dict_keys(self):CODE
LOWtests/test_utils.py161 def test_querydict_multiple_values(self):CODE
LOWtests/test_decorators.py16def stub_require_toolbar_view(request):CODE
LOWtests/test_decorators.py21async def stub_require_toolbar_async_view(request):CODE
LOWtests/test_decorators.py35 def test_require_toolbar_debug_true(self):CODE
LOWtests/test_decorators.py39 def test_require_toolbar_debug_false(self):CODE
LOWtests/test_decorators.py46 async def test_require_toolbar_async_debug_true(self):CODE
LOWtests/test_decorators.py50 async def test_require_toolbar_async_debug_false(self):CODE
LOWtests/test_decorators.py59 def test_uses_toolbar_language(self, mock_language_override):CODE
LOWtests/test_decorators.py64 def test_defaults_to_django_language_code(self, mock_language_override):CODE
LOWtests/test_middleware.py73 def test_async_show_toolbar_callback_sync_middleware(self, mocked_show):CODE
LOWtests/test_middleware.py89 async def test_sync_show_toolbar_callback_async_middleware(self, mocked_show):CODE
LOWtests/test_apps.py16 def test_migrations_are_visible(self, mocked_migration_modules):CODE
LOWtests/test_apps.py24 def test_migrations_are_hidden(self, mocked_migration_modules):CODE
LOWtests/test_csp_rendering.py110 def test_does_not_exist_nonce_wasnt_used(self):CODE
LOWtests/test_csp_rendering.py155 def test_panel_content_nonce_exists(self):CODE
LOWtests/test_store.py24 def test_serialize_binary_data(self):CODE
LOWtests/test_store.py30 def test_deserialize_binary_data(self):CODE
LOWtests/test_store.py40 def test_nested_binary_roundtrip(self):CODE
LOWtests/test_store.py47 def test_postgis_sentinel_falls_back_to_bytes_without_geodjango(self):CODE
LOWtests/test_store.py60 def test_postgis_sentinel_roundtrip_without_geodjango(self):CODE
LOWtests/test_store.py77 def test_serialize_unexpected(self):CODE
LOWtests/test_store.py91 def test_methods_are_not_implemented(self):CODE
LOWtests/test_store.py196 def test_panels_nonexistent_request(self):CODE
LOWtests/test_store.py210 def test_serialize_safestring(self):CODE
LOWtests/test_store.py234 def test_get_store_with_setting(self):CODE
LOWtests/test_store.py307 def test_database_queries_are_efficient(self):CODE
LOWtests/test_store.py349 def test_custom_cache_backend(self):CODE
LOWtests/test_store.py371 def test_cache_store_operations_not_tracked_by_cache_panel(self):CODE
LOWtests/test_store.py458 def test_database_backend_not_tracked_by_sql_panel(self):CODE
LOWtests/test_store.py510 def test_database_backend_can_be_tracked_by_sql_panel(self):CODE
LOWtests/test_toolbar.py12 def test_empty_when_debug_is_false(self):CODE
LOWtests/test_integration.py256 def test_is_toolbar_request_without_djdt_urls(self):CODE
LOWtests/test_integration.py265 def test_is_toolbar_request_override_request_urlconf(self):CODE
LOWtests/test_integration.py274 def test_is_toolbar_request_with_script_prefix(self):CODE
123 more matches not shown…
Cross-File Repetition6 hits · 30 pts
SeverityFileLineSnippetContext
HIGHtests/panels/test_profiling.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
HIGHtests/panels/test_request.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
HIGHtests/panels/test_sql.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
HIGHtests/panels/test_staticfiles.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
HIGHtests/panels/test_cache.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
HIGHtests/panels/test_template.py0test that the panel only inserts content after generate_stats and not the process_request.STRING
Hallucination Indicators2 hits · 20 pts
SeverityFileLineSnippetContext
CRITICALdebug_toolbar/forms.py5from django.core.exceptions import ValidationErrorCODE
CRITICALdebug_toolbar/panels/sql/forms.py2from django.core.exceptions import ValidationErrorCODE
Deep Nesting9 hits · 9 pts
SeverityFileLineSnippetContext
LOWexample/screenshot.py64CODE
LOWtests/test_checks.py243CODE
LOWdebug_toolbar/utils.py107CODE
LOWdebug_toolbar/panels/alerts.py23CODE
LOWdebug_toolbar/panels/staticfiles.py102CODE
LOWdebug_toolbar/panels/staticfiles.py137CODE
LOWdebug_toolbar/panels/templates/panel.py132CODE
LOWdebug_toolbar/panels/sql/panel.py215CODE
LOWdebug_toolbar/panels/sql/tracking.py190CODE
Unused Imports8 hits · 8 pts
SeverityFileLineSnippetContext
LOWexample/async_/settings.py3CODE
LOWtests/test_csp_rendering.py1CODE
LOWdebug_toolbar/toolbar.py5CODE
LOWdebug_toolbar/utils.py1CODE
LOWdebug_toolbar/_compat.py4CODE
LOWdebug_toolbar/_compat.py16CODE
LOWdebug_toolbar/_stubs.py1CODE
LOWdebug_toolbar/management/commands/debugsqlshell.py4CODE
Excessive Try-Catch Wrapping7 hits · 8 pts
SeverityFileLineSnippetContext
LOWdebug_toolbar/utils.py129 except Exception:CODE
LOWdebug_toolbar/utils.py207 except Exception: # findsource raises platform-dependant exceptionsCODE
LOWdebug_toolbar/panels/settings.py14 except Exception as e:CODE
MEDIUMdebug_toolbar/panels/settings.py11def safe_pformat(obj):CODE
LOWdebug_toolbar/panels/templates/panel.py177 except Exception:CODE
LOWdebug_toolbar/panels/templates/views.py25 except Exception:CODE
LOWdebug_toolbar/panels/sql/views.py91 except Exception:CODE
Over-Commented Block7 hits · 7 pts
SeverityFileLineSnippetContext
LOWdocs/conf.py41# Add any paths that contain templates here, relative to this directory.COMMENT
LOWdebug_toolbar/panels/sql/tracking.py61 # methods, including .cursor() and .chunked_cursor(), to raise an exceptionCOMMENT
LOWdebug_toolbar/panels/sql/tracking.py241 # PostgreSQL does not expose any sort of transaction ID, so it isCOMMENT
LOWdebug_toolbar/static/debug_toolbar/css/toolbar.css61 --djdt-button-border-color: #666;COMMENT
LOWdebug_toolbar/static/debug_toolbar/css/toolbar.css81#djDebug h5,COMMENT
LOWdebug_toolbar/static/debug_toolbar/css/toolbar.css101#djDebug s,COMMENT
LOWdebug_toolbar/static/debug_toolbar/css/toolbar.css121#djDebug form,COMMENT
Redundant / Tautological Comments5 hits · 6 pts
SeverityFileLineSnippetContext
LOWexample/screenshot.py75 # Check if SQL Panel is already visible:STRING
LOWdebug_toolbar/apps.py247 # Check if show toolbar callback has changedCOMMENT
LOWdebug_toolbar/apps.py258 # Check if the toolbar's urls are installedCOMMENT
LOWdebug_toolbar/panels/__init__.py30 # Check if the panel is async compatibleCOMMENT
LOWdebug_toolbar/panels/templates/panel.py135 # Check if the layer is in the cache.COMMENT
Self-Referential Comments2 hits · 6 pts
SeverityFileLineSnippetContext
MEDIUMtests/test_store.py425 # Create the database cache tableCOMMENT
MEDIUMdebug_toolbar/store.py210 # Create the entry if it doesn't exist (ignore otherwise)COMMENT
Modern Structural Boilerplate5 hits · 5 pts
SeverityFileLineSnippetContext
LOWdebug_toolbar/__init__.py1__all__ = ["APP_NAME", "VERSION"]CODE
LOWdebug_toolbar/toolbar.py32logger = logging.getLogger(__name__)CODE
LOWdebug_toolbar/panels/templates/__init__.py3__all__ = [TemplatesPanel.panel_id]CODE
LOWdebug_toolbar/panels/sql/__init__.py3__all__ = [SQLPanel.panel_id]CODE
LOWdebug_toolbar/management/commands/debugsqlshell.py17__all__ = ["Command", "PrintQueryWrapper"]CODE