Module: RuboCop::Cop::Isucon::Mixin::SelectAsteriskMethods

Includes:
DatabaseMethods
Included in:
RuboCop::Cop::Isucon::Mysql2::SelectAsterisk, Sqlite3::SelectAsterisk
Defined in:
lib/rubocop/cop/isucon/mixin/select_asterisk_methods.rb

Overview

Constant Summary collapse

MSG =
"Use SELECT with column names. (e.g. `SELECT id, name FROM table_name`)"
TODO =
"# TODO: Remove needless columns if necessary\n"

Instance Method Summary collapse

Methods included from DatabaseMethods

#connection, #enabled_database?, #find_table_name_from_column_name

Instance Method Details

#on_send(node) ⇒ Object

Parameters:

  • node (RuboCop::AST::Node)


16
17
18
19
20
21
22
# File 'lib/rubocop/cop/isucon/mixin/select_asterisk_methods.rb', line 16

def on_send(node)
  with_error_handling(node) do
    with_db_query(node) do |type, root_gda|
      check_and_register_offence(type: type, root_gda: root_gda, node: node)
    end
  end
end