Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RESTRICT_ON_SEND #22

Merged
merged 1 commit into from Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rubocop/cop/sequel/column_default.rb
Expand Up @@ -6,6 +6,7 @@ module Sequel
# ColumnDefault looks for column creation with a default value.
class ColumnDefault < Base
MSG = "Don't create new column with default values"
RESTRICT_ON_SEND = %i[add_column].freeze

def_node_matcher :add_column_default?, <<-MATCHER
(send _ :add_column ... (hash (pair (sym :default) _)))
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/sequel/concurrent_index.rb
Expand Up @@ -6,6 +6,7 @@ module Sequel
# ConcurrentIndex looks for non-concurrent index creation.
class ConcurrentIndex < Base
MSG = 'Prefer creating or dropping new index concurrently'
RESTRICT_ON_SEND = %i[add_index drop_index].freeze

def_node_matcher :indexes?, <<-MATCHER
(send _ {:add_index :drop_index} $...)
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/sequel/json_column.rb
Expand Up @@ -6,6 +6,7 @@ module Sequel
# JSONColumn looks for non-JSONB columns.
class JSONColumn < Base
MSG = 'Use JSONB rather than JSON or hstore'
RESTRICT_ON_SEND = %i[add_column].freeze

def_node_matcher :json_or_hstore?, <<-MATCHER
(send _ :add_column ... (sym {:json :hstore}))
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/sequel/partial_constraint.rb
Expand Up @@ -6,6 +6,7 @@ module Sequel
# PartialConstraint looks for missed usage of partial indexes.
class PartialConstraint < Base
MSG = "Constraint can't be partial, use where argument with index"
RESTRICT_ON_SEND = %i[add_unique_constraint].freeze

def_node_matcher :add_partial_constraint?, <<-MATCHER
(send _ :add_unique_constraint ... (hash (pair (sym :where) _)))
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/cop/sequel/save_changes.rb
Expand Up @@ -9,6 +9,7 @@ class SaveChanges < Base

MSG = 'Use `Sequel::Model#save_changes` instead of '\
'`Sequel::Model#save`.'
RESTRICT_ON_SEND = %i[save].freeze

def_node_matcher :model_save?, <<-MATCHER
(send _ :save)
Expand Down