Repository Analysis

dbcli/pgcli

Postgres CLI with autocompletion and syntax highlighting

26.6 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of dbcli/pgcli, a Python project with 13,300 GitHub stars. SynthScan v2.0 examined 15,495 lines of code across 89 source files, recording 381 pattern matches distributed across 10 syntactic categories. The overall adjusted score of 26.6 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).

26.6
Adjusted Score
26.6
Raw Score
100%
Time Factor
2026-06-03
Last Push
13.3K
Stars
Python
Language
15.5K
Lines of Code
89
Files
381
Pattern Hits
2026-07-14
Scan Date
0.08
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 0HIGH 7MEDIUM 5LOW 369

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 381 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 Identifiers330 hits · 327 pts
SeverityFileLineSnippetContext
LOWrelease.py56def get_merged_prs_since_last_tag():CODE
LOWrelease.py99def create_distribution_files():CODE
LOWrelease.py104def upload_distribution_files():CODE
LOWpgcli/pgcompleter.py605 def get_join_condition_matches(self, suggestion, word_before_cursor):CODE
LOWpgcli/pgcompleter.py702 def get_from_clause_item_matches(self, suggestion, word_before_cursor):CODE
LOWpgcli/pyev.py94 def calculate_planner_estimate(self, plan):CODE
LOWpgcli/pgtoolbar.py19def create_toolbar_tokens_func(pgcli):CODE
LOWpgcli/pgexecute.py27def remove_beginning_comments(command):CODE
LOWpgcli/main.py322 def _is_named_query_execution(self, text):CODE
LOWpgcli/main.py327 def register_special_commands(self):CODE
LOWpgcli/main.py1230 def _handle_server_closed_connection(self, text):CODE
LOWpgcli/main.py1264 def _on_completions_refreshed(self, new_completer, persist_priorities):CODE
LOWpgcli/main.py1735def obfuscate_process_password():CODE
LOWpgcli/main.py929 def _check_ongoing_transaction_and_allow_quitting(self):STRING
LOWpgcli/packages/sqlcompletion.py185def _split_multiple_statements(full_text, text_before_cursor, parsed):CODE
LOWpgcli/packages/sqlcompletion.py281def suggest_based_on_last_token(token, stmt):CODE
LOWpgcli/packages/prompt_utils.py6def confirm_destructive_query(queries, keywords, alias):CODE
LOWpgcli/packages/parseutils/__init__.py23def query_is_unconditional_update(formatted_sql):CODE
LOWpgcli/packages/parseutils/__init__.py41def parse_destructive_warning(warning_level):CODE
LOWpgcli/packages/parseutils/tables.py75def extract_table_identifiers(token_stream, allow_functions=True):CODE
LOWtests/test_pgexecute.py509def test_multiple_queries_same_line(executor):CODE
LOWtests/test_pgexecute.py517def test_multiple_queries_with_special_command_same_line(executor, pgspecial):CODE
LOWtests/test_pgexecute.py526def test_multiple_queries_same_line_syntaxerror(executor, exception_formatter):CODE
LOWtests/test_pgexecute.py542def test_special_command_help(executor, pgspecial):CODE
LOWtests/test_pgexecute.py549def test_bytea_field_support_in_output(executor):CODE
LOWtests/test_pgexecute.py557def test_unicode_support_in_unknown_type(executor):CODE
LOWtests/test_pgexecute.py562def test_unicode_support_in_enum_type(executor):CODE
LOWtests/test_pgexecute.py570def test_json_renders_without_u_prefix(executor, expanded):CODE
LOWtests/test_pgexecute.py579def test_jsonb_renders_without_u_prefix(executor, expanded):CODE
LOWtests/test_pgexecute.py74def test_bools_are_treated_as_strings(executor):CODE
LOWtests/test_pgexecute.py98def test_schemata_table_views_and_columns_query(executor):CODE
LOWtests/test_pgexecute.py227def test_invalid_syntax_verbose(executor):CODE
LOWtests/test_pgexecute.py277def test_execute_from_file_no_arg(executor, pgspecial):CODE
LOWtests/test_pgexecute.py288def test_execute_from_file_io_error(os, executor, pgspecial):CODE
LOWtests/test_pgexecute.py302def test_execute_from_commented_file_that_executes_another_file(executor, pgspecial, tmpdir):CODE
LOWtests/test_pgexecute.py320def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):CODE
LOWtests/test_pgexecute.py418def test_execute_commented_first_line_and_normal(executor, pgspecial, tmpdir):CODE
LOWtests/test_pgexecute.py609def test_large_numbers_render_directly(executor, value):CODE
LOWtests/test_pgexecute.py628def test_raises_with_no_formatter(executor, sql):CODE
LOWtests/test_pgexecute.py655def test_nonexistent_function_definition(executor):CODE
LOWtests/test_pgexecute.py677def test_function_notice_order(executor):CODE
LOWtests/test_pgexecute.py722def test_nonexistent_view_definition(executor):CODE
LOWtests/test_pgexecute.py759def test_exit_without_active_connection(executor):CODE
LOWtests/test_pgexecute.py258def test_unicode_support_in_output(executor, expanded):STRING
LOWtests/test_ssh_tunnel.py14def mock_ssh_tunnel_forwarder() -> MagicMock:CODE
LOWtests/test_rowlimit.py95def test_row_limit_on_non_select(over_limit):CODE
LOWtests/metadata.py112 def columns_functions_and_keywords(self, tbl, parent="public", typ="tables", pos=0):CODE
LOWtests/metadata.py118 def schemas_and_from_clause_items(self, parent="public", pos=0):CODE
LOWtests/test_auth.py15def test_keyring_get_password_ok():CODE
LOWtests/test_auth.py21def test_keyring_get_password_exception():CODE
LOWtests/test_auth.py27def test_keyring_set_password_ok():CODE
LOWtests/test_auth.py33def test_keyring_set_password_exception():CODE
LOWtests/test_fuzzy_completion.py11def test_ranking_ignores_identifier_quotes(completer):CODE
LOWtests/test_fuzzy_completion.py31def test_ranking_based_on_shortest_match(completer):CODE
LOWtests/test_fuzzy_completion.py56def test_should_break_ties_using_lexical_order(completer, collection):CODE
LOWtests/test_fuzzy_completion.py76def test_matching_should_be_case_insensitive(completer):CODE
LOWtests/test_smart_completion_multiple_schemata.py248def test_suggested_column_names_with_qualified_alias(completer):CODE
LOWtests/test_smart_completion_multiple_schemata.py254def test_suggested_multiple_column_names(completer):CODE
LOWtests/test_smart_completion_multiple_schemata.py260def test_suggested_multiple_column_names_with_alias(completer):CODE
LOWtests/test_smart_completion_multiple_schemata.py286def test_suggested_aliases_after_on_right_side(completer):CODE
270 more matches not shown…
Cross-File Repetition7 hits · 35 pts
SeverityFileLineSnippetContext
HIGHtests/features/steps/crud_database.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/named_queries.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/crud_table.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/basic_commands.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/pgbouncer.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/specials.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
HIGHtests/features/steps/expanded.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this striSTRING
Excessive Try-Catch Wrapping16 hits · 17 pts
SeverityFileLineSnippetContext
LOWpgcli/auth.py39 except Exception as e:CODE
LOWpgcli/auth.py51 except Exception as e:CODE
MEDIUMpgcli/auth.py48def keyring_set_password(key, passwd):CODE
MEDIUMpgcli/main.py438def change_table_format(self, pattern, **_):CODE
LOWpgcli/main.py714 except Exception as e:CODE
LOWpgcli/main.py767 except Exception as e: # Connecting to a database could fail.CODE
LOWpgcli/main.py1546 except Exception:CODE
LOWpgcli/main.py1605 except Exception:CODE
LOWpgcli/main.py1710 except Exception:CODE
LOWpgcli/main.py1752 except Exception:CODE
LOWpgcli/main.py1764 except Exception:CODE
LOWpgcli/main.py854 except Exception as e:STRING
LOWtests/utils.py30except Exception:CODE
LOWtests/utils.py51 except Exception:CODE
LOWtests/features/environment.py198 except Exception as x:CODE
LOWtests/features/db_utils.py48 except Exception:CODE
Deep Nesting15 hits · 14 pts
SeverityFileLineSnippetContext
LOWpgcli/pgcompleter.py885CODE
LOWpgcli/pyev.py159CODE
LOWpgcli/pgexecute.py317CODE
LOWpgcli/main.py1493CODE
LOWpgcli/main.py1859CODE
LOWpgcli/main.py775CODE
LOWpgcli/main.py813CODE
LOWpgcli/main.py959CODE
LOWpgcli/main.py1272CODE
LOWpgcli/packages/sqlcompletion.py229CODE
LOWpgcli/packages/sqlcompletion.py281CODE
LOWpgcli/packages/formatter/sqlformatter.py26CODE
LOWpgcli/packages/parseutils/tables.py36CODE
LOWpgcli/packages/parseutils/tables.py75CODE
LOWpgcli/packages/parseutils/meta.py24CODE
Self-Referential Comments3 hits · 9 pts
SeverityFileLineSnippetContext
MEDIUMpgcli/completion_refresher.py55 # Create a new pgexecute method to populate the completions.COMMENT
MEDIUMtests/test_init_commands_simple.py54 # Create a temporary config file with init-commandsCOMMENT
MEDIUMtests/test_init_commands_simple.py72 # Create a temporary config file with init-commandsCOMMENT
Redundant / Tautological Comments3 hits · 3 pts
SeverityFileLineSnippetContext
LOWpgcli/main.py640 # Check if DSN contains a password - if so, don't use PGPASSWORDCOMMENT
LOWpgcli/main.py914 # Check if we need to update completions, in order of mostSTRING
LOWtests/test_completion_refresher.py91 # Set refreshers to 0: we're not testing refresh logic hereCOMMENT
Over-Commented Block3 hits · 3 pts
SeverityFileLineSnippetContext
LOWpgcli/packages/sqlcompletion.py281def suggest_based_on_last_token(token, stmt):COMMENT
LOWpgcli/packages/sqlcompletion.py321COMMENT
LOWpgcli/packages/parseutils/tables.py141 # abc is the table name, but if we don't stop at the first lparen, thenCOMMENT
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippetContext
LOWpgcli/main.py203 # make sure to use self.config_writer, not self.configCOMMENT
AI Structural Patterns2 hits · 2 pts
SeverityFileLineSnippetContext
LOWpgcli/main.py174CODE
LOWtests/test_pgexecute.py14CODE
Modern Structural Boilerplate1 hit · 1 pts
SeverityFileLineSnippetContext
LOWpgcli/pgstyle.py10logger = logging.getLogger(__name__)CODE