Repository Analysis

dbcli/pgcli

Postgres CLI with autocompletion and syntax highlighting

26.2 Moderate AI signal View on GitHub
26.2
Adjusted Score
26.2
Raw Score
100%
Time Factor
2026-05-12
Last Push
13,190
Stars
Python
Language
15,321
Lines of Code
88
Files
371
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 7MEDIUM 5LOW 359

Pattern Findings

371 matches across 8 categories. Click a row to expand file-level details.

Hyper-Verbose Identifiers323 hits · 317 pts
SeverityFileLineSnippet
LOWrelease.py66def create_distribution_files():
LOWrelease.py71def upload_distribution_files():
LOWpgcli/pgcompleter.py605 def get_join_condition_matches(self, suggestion, word_before_cursor):
LOWpgcli/pgcompleter.py702 def get_from_clause_item_matches(self, suggestion, word_before_cursor):
LOWpgcli/pyev.py94 def calculate_planner_estimate(self, plan):
LOWpgcli/pgtoolbar.py19def create_toolbar_tokens_func(pgcli):
LOWpgcli/pgexecute.py27def remove_beginning_comments(command):
LOWpgcli/main.py320 def _is_named_query_execution(self, text):
LOWpgcli/main.py325 def register_special_commands(self):
LOWpgcli/main.py1228 def _handle_server_closed_connection(self, text):
LOWpgcli/main.py1262 def _on_completions_refreshed(self, new_completer, persist_priorities):
LOWpgcli/main.py1733def obfuscate_process_password():
LOWpgcli/main.py927 def _check_ongoing_transaction_and_allow_quitting(self):
LOWpgcli/packages/sqlcompletion.py185def _split_multiple_statements(full_text, text_before_cursor, parsed):
LOWpgcli/packages/sqlcompletion.py281def suggest_based_on_last_token(token, stmt):
LOWpgcli/packages/prompt_utils.py6def confirm_destructive_query(queries, keywords, alias):
LOWpgcli/packages/parseutils/__init__.py23def query_is_unconditional_update(formatted_sql):
LOWpgcli/packages/parseutils/__init__.py41def parse_destructive_warning(warning_level):
LOWpgcli/packages/parseutils/tables.py75def extract_table_identifiers(token_stream, allow_functions=True):
LOWtests/test_pgexecute.py509def test_multiple_queries_same_line(executor):
LOWtests/test_pgexecute.py517def test_multiple_queries_with_special_command_same_line(executor, pgspecial):
LOWtests/test_pgexecute.py526def test_multiple_queries_same_line_syntaxerror(executor, exception_formatter):
LOWtests/test_pgexecute.py542def test_special_command_help(executor, pgspecial):
LOWtests/test_pgexecute.py549def test_bytea_field_support_in_output(executor):
LOWtests/test_pgexecute.py557def test_unicode_support_in_unknown_type(executor):
LOWtests/test_pgexecute.py562def test_unicode_support_in_enum_type(executor):
LOWtests/test_pgexecute.py570def test_json_renders_without_u_prefix(executor, expanded):
LOWtests/test_pgexecute.py579def test_jsonb_renders_without_u_prefix(executor, expanded):
LOWtests/test_pgexecute.py74def test_bools_are_treated_as_strings(executor):
LOWtests/test_pgexecute.py98def test_schemata_table_views_and_columns_query(executor):
LOWtests/test_pgexecute.py227def test_invalid_syntax_verbose(executor):
LOWtests/test_pgexecute.py277def test_execute_from_file_no_arg(executor, pgspecial):
LOWtests/test_pgexecute.py288def test_execute_from_file_io_error(os, executor, pgspecial):
LOWtests/test_pgexecute.py302def test_execute_from_commented_file_that_executes_another_file(executor, pgspecial, tmpdir):
LOWtests/test_pgexecute.py320def test_execute_commented_first_line_and_special(executor, pgspecial, tmpdir):
LOWtests/test_pgexecute.py418def test_execute_commented_first_line_and_normal(executor, pgspecial, tmpdir):
LOWtests/test_pgexecute.py609def test_large_numbers_render_directly(executor, value):
LOWtests/test_pgexecute.py628def test_raises_with_no_formatter(executor, sql):
LOWtests/test_pgexecute.py655def test_nonexistent_function_definition(executor):
LOWtests/test_pgexecute.py677def test_function_notice_order(executor):
LOWtests/test_pgexecute.py722def test_nonexistent_view_definition(executor):
LOWtests/test_pgexecute.py759def test_exit_without_active_connection(executor):
LOWtests/test_pgexecute.py258def test_unicode_support_in_output(executor, expanded):
LOWtests/test_ssh_tunnel.py14def mock_ssh_tunnel_forwarder() -> MagicMock:
LOWtests/test_rowlimit.py71def test_row_limit_on_non_select(over_limit):
LOWtests/metadata.py112 def columns_functions_and_keywords(self, tbl, parent="public", typ="tables", pos=0):
LOWtests/metadata.py118 def schemas_and_from_clause_items(self, parent="public", pos=0):
LOWtests/test_auth.py15def test_keyring_get_password_ok():
LOWtests/test_auth.py21def test_keyring_get_password_exception():
LOWtests/test_auth.py27def test_keyring_set_password_ok():
LOWtests/test_auth.py33def test_keyring_set_password_exception():
LOWtests/test_fuzzy_completion.py11def test_ranking_ignores_identifier_quotes(completer):
LOWtests/test_fuzzy_completion.py31def test_ranking_based_on_shortest_match(completer):
LOWtests/test_fuzzy_completion.py56def test_should_break_ties_using_lexical_order(completer, collection):
LOWtests/test_fuzzy_completion.py76def test_matching_should_be_case_insensitive(completer):
LOWtests/test_smart_completion_multiple_schemata.py248def test_suggested_column_names_with_qualified_alias(completer):
LOWtests/test_smart_completion_multiple_schemata.py254def test_suggested_multiple_column_names(completer):
LOWtests/test_smart_completion_multiple_schemata.py260def test_suggested_multiple_column_names_with_alias(completer):
LOWtests/test_smart_completion_multiple_schemata.py286def test_suggested_aliases_after_on_right_side(completer):
LOWtests/test_smart_completion_multiple_schemata.py293def test_table_names_after_from(completer):
263 more matches not shown…
Cross-File Repetition7 hits · 35 pts
SeverityFileLineSnippet
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 stri
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 stri
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 stri
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 stri
HIGHtests/features/steps/pgbouncer.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri
HIGHtests/features/steps/specials.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri
HIGHtests/features/steps/expanded.py0steps for behavioral style tests are defined in this module. each step is defined by the string decorating it. this stri
Excessive Try-Catch Wrapping16 hits · 17 pts
SeverityFileLineSnippet
LOWpgcli/auth.py39 except Exception as e:
LOWpgcli/auth.py51 except Exception as e:
MEDIUMpgcli/auth.py48def keyring_set_password(key, passwd):
MEDIUMpgcli/main.py436def change_table_format(self, pattern, **_):
LOWpgcli/main.py712 except Exception as e:
LOWpgcli/main.py765 except Exception as e: # Connecting to a database could fail.
LOWpgcli/main.py1544 except Exception:
LOWpgcli/main.py1603 except Exception:
LOWpgcli/main.py1708 except Exception:
LOWpgcli/main.py1750 except Exception:
LOWpgcli/main.py1762 except Exception:
LOWpgcli/main.py852 except Exception as e:
LOWtests/utils.py30except Exception:
LOWtests/utils.py51 except Exception:
LOWtests/features/environment.py198 except Exception as x:
LOWtests/features/db_utils.py48 except Exception:
Deep Nesting15 hits · 14 pts
SeverityFileLineSnippet
LOWpgcli/pgcompleter.py885
LOWpgcli/pyev.py159
LOWpgcli/pgexecute.py317
LOWpgcli/main.py1491
LOWpgcli/main.py1857
LOWpgcli/main.py773
LOWpgcli/main.py811
LOWpgcli/main.py957
LOWpgcli/main.py1270
LOWpgcli/packages/sqlcompletion.py229
LOWpgcli/packages/sqlcompletion.py281
LOWpgcli/packages/formatter/sqlformatter.py26
LOWpgcli/packages/parseutils/tables.py36
LOWpgcli/packages/parseutils/tables.py75
LOWpgcli/packages/parseutils/meta.py24
Self-Referential Comments3 hits · 9 pts
SeverityFileLineSnippet
MEDIUMpgcli/completion_refresher.py55 # Create a new pgexecute method to populate the completions.
MEDIUMtests/test_init_commands_simple.py54 # Create a temporary config file with init-commands
MEDIUMtests/test_init_commands_simple.py72 # Create a temporary config file with init-commands
Redundant / Tautological Comments3 hits · 3 pts
SeverityFileLineSnippet
LOWpgcli/main.py638 # Check if DSN contains a password - if so, don't use PGPASSWORD
LOWpgcli/main.py912 # Check if we need to update completions, in order of most
LOWtests/test_completion_refresher.py91 # Set refreshers to 0: we're not testing refresh logic here
Over-Commented Block3 hits · 3 pts
SeverityFileLineSnippet
LOWpgcli/packages/sqlcompletion.py281def suggest_based_on_last_token(token, stmt):
LOWpgcli/packages/sqlcompletion.py321
LOWpgcli/packages/parseutils/tables.py141 # abc is the table name, but if we don't stop at the first lparen, then
Slop Phrases1 hit · 2 pts
SeverityFileLineSnippet
LOWpgcli/main.py201 # make sure to use self.config_writer, not self.config