Postgres CLI with autocompletion and syntax highlighting
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).
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 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.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | release.py | 56 | def get_merged_prs_since_last_tag(): | CODE |
| LOW | release.py | 99 | def create_distribution_files(): | CODE |
| LOW | release.py | 104 | def upload_distribution_files(): | CODE |
| LOW | pgcli/pgcompleter.py | 605 | def get_join_condition_matches(self, suggestion, word_before_cursor): | CODE |
| LOW | pgcli/pgcompleter.py | 702 | def get_from_clause_item_matches(self, suggestion, word_before_cursor): | CODE |
| LOW | pgcli/pyev.py | 94 | def calculate_planner_estimate(self, plan): | CODE |
| LOW | pgcli/pgtoolbar.py | 19 | def create_toolbar_tokens_func(pgcli): | CODE |
| LOW | pgcli/pgexecute.py | 27 | def remove_beginning_comments(command): | CODE |
| LOW | pgcli/main.py | 322 | def _is_named_query_execution(self, text): | CODE |
| LOW | pgcli/main.py | 327 | def register_special_commands(self): | CODE |
| LOW | pgcli/main.py | 1230 | def _handle_server_closed_connection(self, text): | CODE |
| LOW | pgcli/main.py | 1264 | def _on_completions_refreshed(self, new_completer, persist_priorities): | CODE |
| LOW | pgcli/main.py | 1735 | def obfuscate_process_password(): | CODE |
| LOW | pgcli/main.py | 929 | def _check_ongoing_transaction_and_allow_quitting(self): | STRING |
| LOW | pgcli/packages/sqlcompletion.py | 185 | def _split_multiple_statements(full_text, text_before_cursor, parsed): | CODE |
| LOW | pgcli/packages/sqlcompletion.py | 281 | def suggest_based_on_last_token(token, stmt): | CODE |
| LOW | pgcli/packages/prompt_utils.py | 6 | def confirm_destructive_query(queries, keywords, alias): | CODE |
| LOW | pgcli/packages/parseutils/__init__.py | 23 | def query_is_unconditional_update(formatted_sql): | CODE |
| LOW | pgcli/packages/parseutils/__init__.py | 41 | def parse_destructive_warning(warning_level): | CODE |
| LOW | pgcli/packages/parseutils/tables.py | 75 | def extract_table_identifiers(token_stream, allow_functions=True): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 509 | def test_multiple_queries_same_line(executor): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 517 | def test_multiple_queries_with_special_command_same_line(executor, pgspecial): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 526 | def test_multiple_queries_same_line_syntaxerror(executor, exception_formatter): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 542 | def test_special_command_help(executor, pgspecial): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 549 | def test_bytea_field_support_in_output(executor): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 557 | def test_unicode_support_in_unknown_type(executor): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 562 | def test_unicode_support_in_enum_type(executor): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 570 | def test_json_renders_without_u_prefix(executor, expanded): | CODE |
| LOW⚡ | tests/test_pgexecute.py | 579 | def test_jsonb_renders_without_u_prefix(executor, expanded): | CODE |
| LOW | tests/test_pgexecute.py | 74 | def test_bools_are_treated_as_strings(executor): | CODE |
| LOW | tests/test_pgexecute.py | 98 | def test_schemata_table_views_and_columns_query(executor): | CODE |
| LOW | tests/test_pgexecute.py | 227 | def test_invalid_syntax_verbose(executor): | CODE |
| LOW | tests/test_pgexecute.py | 277 | def test_execute_from_file_no_arg(executor, pgspecial): | CODE |
| LOW | tests/test_pgexecute.py | 288 | def test_execute_from_file_io_error(os, executor, pgspecial): | CODE |
| LOW | tests/test_pgexecute.py | 302 | def test_execute_from_commented_file_that_executes_another_file(executor, pgspecial, tmpdir): | CODE |
| LOW | tests/test_pgexecute.py | 320 | def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir): | CODE |
| LOW | tests/test_pgexecute.py | 418 | def test_execute_commented_first_line_and_normal(executor, pgspecial, tmpdir): | CODE |
| LOW | tests/test_pgexecute.py | 609 | def test_large_numbers_render_directly(executor, value): | CODE |
| LOW | tests/test_pgexecute.py | 628 | def test_raises_with_no_formatter(executor, sql): | CODE |
| LOW | tests/test_pgexecute.py | 655 | def test_nonexistent_function_definition(executor): | CODE |
| LOW | tests/test_pgexecute.py | 677 | def test_function_notice_order(executor): | CODE |
| LOW | tests/test_pgexecute.py | 722 | def test_nonexistent_view_definition(executor): | CODE |
| LOW | tests/test_pgexecute.py | 759 | def test_exit_without_active_connection(executor): | CODE |
| LOW | tests/test_pgexecute.py | 258 | def test_unicode_support_in_output(executor, expanded): | STRING |
| LOW | tests/test_ssh_tunnel.py | 14 | def mock_ssh_tunnel_forwarder() -> MagicMock: | CODE |
| LOW | tests/test_rowlimit.py | 95 | def test_row_limit_on_non_select(over_limit): | CODE |
| LOW | tests/metadata.py | 112 | def columns_functions_and_keywords(self, tbl, parent="public", typ="tables", pos=0): | CODE |
| LOW | tests/metadata.py | 118 | def schemas_and_from_clause_items(self, parent="public", pos=0): | CODE |
| LOW⚡ | tests/test_auth.py | 15 | def test_keyring_get_password_ok(): | CODE |
| LOW⚡ | tests/test_auth.py | 21 | def test_keyring_get_password_exception(): | CODE |
| LOW⚡ | tests/test_auth.py | 27 | def test_keyring_set_password_ok(): | CODE |
| LOW⚡ | tests/test_auth.py | 33 | def test_keyring_set_password_exception(): | CODE |
| LOW | tests/test_fuzzy_completion.py | 11 | def test_ranking_ignores_identifier_quotes(completer): | CODE |
| LOW | tests/test_fuzzy_completion.py | 31 | def test_ranking_based_on_shortest_match(completer): | CODE |
| LOW | tests/test_fuzzy_completion.py | 56 | def test_should_break_ties_using_lexical_order(completer, collection): | CODE |
| LOW | tests/test_fuzzy_completion.py | 76 | def test_matching_should_be_case_insensitive(completer): | CODE |
| LOW⚡ | tests/test_smart_completion_multiple_schemata.py | 248 | def test_suggested_column_names_with_qualified_alias(completer): | CODE |
| LOW⚡ | tests/test_smart_completion_multiple_schemata.py | 254 | def test_suggested_multiple_column_names(completer): | CODE |
| LOW⚡ | tests/test_smart_completion_multiple_schemata.py | 260 | def test_suggested_multiple_column_names_with_alias(completer): | CODE |
| LOW⚡ | tests/test_smart_completion_multiple_schemata.py | 286 | def test_suggested_aliases_after_on_right_side(completer): | CODE |
| 270 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| HIGH | tests/features/steps/crud_database.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/named_queries.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/crud_table.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/basic_commands.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/pgbouncer.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/specials.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| HIGH | tests/features/steps/expanded.py | 0 | steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri | STRING |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/auth.py | 39 | except Exception as e: | CODE |
| LOW | pgcli/auth.py | 51 | except Exception as e: | CODE |
| MEDIUM | pgcli/auth.py | 48 | def keyring_set_password(key, passwd): | CODE |
| MEDIUM | pgcli/main.py | 438 | def change_table_format(self, pattern, **_): | CODE |
| LOW | pgcli/main.py | 714 | except Exception as e: | CODE |
| LOW | pgcli/main.py | 767 | except Exception as e: # Connecting to a database could fail. | CODE |
| LOW | pgcli/main.py | 1546 | except Exception: | CODE |
| LOW | pgcli/main.py | 1605 | except Exception: | CODE |
| LOW | pgcli/main.py | 1710 | except Exception: | CODE |
| LOW | pgcli/main.py | 1752 | except Exception: | CODE |
| LOW | pgcli/main.py | 1764 | except Exception: | CODE |
| LOW | pgcli/main.py | 854 | except Exception as e: | STRING |
| LOW | tests/utils.py | 30 | except Exception: | CODE |
| LOW | tests/utils.py | 51 | except Exception: | CODE |
| LOW | tests/features/environment.py | 198 | except Exception as x: | CODE |
| LOW | tests/features/db_utils.py | 48 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/pgcompleter.py | 885 | CODE | |
| LOW | pgcli/pyev.py | 159 | CODE | |
| LOW | pgcli/pgexecute.py | 317 | CODE | |
| LOW | pgcli/main.py | 1493 | CODE | |
| LOW | pgcli/main.py | 1859 | CODE | |
| LOW | pgcli/main.py | 775 | CODE | |
| LOW | pgcli/main.py | 813 | CODE | |
| LOW | pgcli/main.py | 959 | CODE | |
| LOW | pgcli/main.py | 1272 | CODE | |
| LOW | pgcli/packages/sqlcompletion.py | 229 | CODE | |
| LOW | pgcli/packages/sqlcompletion.py | 281 | CODE | |
| LOW | pgcli/packages/formatter/sqlformatter.py | 26 | CODE | |
| LOW | pgcli/packages/parseutils/tables.py | 36 | CODE | |
| LOW | pgcli/packages/parseutils/tables.py | 75 | CODE | |
| LOW | pgcli/packages/parseutils/meta.py | 24 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | pgcli/completion_refresher.py | 55 | # Create a new pgexecute method to populate the completions. | COMMENT |
| MEDIUM | tests/test_init_commands_simple.py | 54 | # Create a temporary config file with init-commands | COMMENT |
| MEDIUM | tests/test_init_commands_simple.py | 72 | # Create a temporary config file with init-commands | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/main.py | 640 | # Check if DSN contains a password - if so, don't use PGPASSWORD | COMMENT |
| LOW | pgcli/main.py | 914 | # Check if we need to update completions, in order of most | STRING |
| LOW | tests/test_completion_refresher.py | 91 | # Set refreshers to 0: we're not testing refresh logic here | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/packages/sqlcompletion.py | 281 | def suggest_based_on_last_token(token, stmt): | COMMENT |
| LOW | pgcli/packages/sqlcompletion.py | 321 | COMMENT | |
| LOW | pgcli/packages/parseutils/tables.py | 141 | # abc is the table name, but if we don't stop at the first lparen, then | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/main.py | 203 | # make sure to use self.config_writer, not self.config | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/main.py | 174 | CODE | |
| LOW | tests/test_pgexecute.py | 14 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | pgcli/pgstyle.py | 10 | logger = logging.getLogger(__name__) | CODE |