rubocop-sequel 0.3.0 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 260beb7a94809075be127b7eac43b03b1acc661038009ea8c189bb91f543bdf0
4
- data.tar.gz: '0815a252def8ee363d59bdc19f8c317b8f68bf9a89a50ed15bd79730bbc9fa60'
3
+ metadata.gz: 9946d5d75823d8bf843b76fcf363080f6fe7b89898a5cd83fda2c2474f75e188
4
+ data.tar.gz: ca925b88e4778ae0a255f24d3ab03c1802989d64943b3b74128c305fb99405d5
5
5
  SHA512:
6
- metadata.gz: fa012f6644b9360e4d3d8c3d9ceb1b00165bab142f6dab7521d7289a8caa09704b6d27224cae6490b9a86067a7058bd657ac59f975c51e242807d65243678b3a
7
- data.tar.gz: 19aa510cdf0b8ec211d1bca4377652afa877a7c4e52d8804a45099008d0a763c008dac616b15e5074e71bbe98800d5c3d54f98fde5dc1fd29600ca197a6233ea
6
+ metadata.gz: f68ad1bd6c68025ed7d974e4d68f900583bfa9e7136247be140930a9d40a5c6a22c6be9a671c6f3042d6a0ce3655c9932405c0d4ce0900a1e4a9d991f425aff0
7
+ data.tar.gz: 7f020ea08ebc0f993e4809ff47c240663ca4b0d4854fafb28773fc25d16f210cabf435e194ee3c2d4bf7dd5acc7c1bc2a3364de7ca0501bc2f412d7383bbbac4
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![CI status](https://github.com/rubocop-hq/rubocop-sequel/workflows/CI/badge.svg)
1
+ ![CI status](https://github.com/rubocop/rubocop-sequel/workflows/CI/badge.svg)
2
2
 
3
3
  # RuboCop Sequel
4
4
 
@@ -6,6 +6,7 @@ module RuboCop
6
6
  # ColumnDefault looks for column creation with a default value.
7
7
  class ColumnDefault < Base
8
8
  MSG = "Don't create new column with default values"
9
+ RESTRICT_ON_SEND = %i[add_column].freeze
9
10
 
10
11
  def_node_matcher :add_column_default?, <<-MATCHER
11
12
  (send _ :add_column ... (hash (pair (sym :default) _)))
@@ -6,6 +6,7 @@ module RuboCop
6
6
  # ConcurrentIndex looks for non-concurrent index creation.
7
7
  class ConcurrentIndex < Base
8
8
  MSG = 'Prefer creating or dropping new index concurrently'
9
+ RESTRICT_ON_SEND = %i[add_index drop_index].freeze
9
10
 
10
11
  def_node_matcher :indexes?, <<-MATCHER
11
12
  (send _ {:add_index :drop_index} $...)
@@ -6,6 +6,7 @@ module RuboCop
6
6
  # JSONColumn looks for non-JSONB columns.
7
7
  class JSONColumn < Base
8
8
  MSG = 'Use JSONB rather than JSON or hstore'
9
+ RESTRICT_ON_SEND = %i[add_column].freeze
9
10
 
10
11
  def_node_matcher :json_or_hstore?, <<-MATCHER
11
12
  (send _ :add_column ... (sym {:json :hstore}))
@@ -4,8 +4,9 @@ module RuboCop
4
4
  module Cop
5
5
  module Sequel
6
6
  # PartialConstraint looks for missed usage of partial indexes.
7
- class PartialConstraint < Cop
7
+ class PartialConstraint < Base
8
8
  MSG = "Constraint can't be partial, use where argument with index"
9
+ RESTRICT_ON_SEND = %i[add_unique_constraint].freeze
9
10
 
10
11
  def_node_matcher :add_partial_constraint?, <<-MATCHER
11
12
  (send _ :add_unique_constraint ... (hash (pair (sym :where) _)))
@@ -14,7 +15,7 @@ module RuboCop
14
15
  def on_send(node)
15
16
  return unless add_partial_constraint?(node)
16
17
 
17
- add_offense(node, location: :selector, message: MSG)
18
+ add_offense(node.loc.selector, message: MSG)
18
19
  end
19
20
  end
20
21
  end
@@ -9,6 +9,7 @@ module RuboCop
9
9
 
10
10
  MSG = 'Use `Sequel::Model#save_changes` instead of '\
11
11
  '`Sequel::Model#save`.'
12
+ RESTRICT_ON_SEND = %i[save].freeze
12
13
 
13
14
  def_node_matcher :model_save?, <<-MATCHER
14
15
  (send _ :save)
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Sequel
5
+ # This module holds the RuboCop Sequel version information.
6
+ module Version
7
+ STRING = '0.3.4'
8
+ end
9
+ end
10
+ end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'rubocop'
4
4
 
5
+ require 'rubocop/sequel/version'
5
6
  require 'rubocop/cop/sequel/column_default'
6
7
  require 'rubocop/cop/sequel/concurrent_index'
7
8
  require 'rubocop/cop/sequel/json_column'
@@ -5,15 +5,15 @@ Gem::Specification.new do |gem|
5
5
  gem.email = ['timothee.peignier@tryphon.org']
6
6
  gem.description = 'Code style checking for Sequel'
7
7
  gem.summary = 'A Sequel plugin for RuboCop'
8
- gem.homepage = 'https://github.com/rubocop-hq/rubocop-sequel'
8
+ gem.homepage = 'https://github.com/rubocop/rubocop-sequel'
9
9
  gem.license = 'MIT'
10
10
 
11
11
  gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
13
  gem.name = 'rubocop-sequel'
15
14
  gem.require_paths = ['lib']
16
- gem.version = '0.3.0'
15
+ gem.version = '0.3.4'
16
+ gem.metadata['rubygems_mfa_required'] = 'true'
17
17
 
18
18
  gem.required_ruby_version = '>= 2.5'
19
19
 
@@ -6,10 +6,10 @@ describe RuboCop::Cop::Sequel::PartialConstraint do
6
6
  subject(:cop) { described_class.new }
7
7
 
8
8
  it 'registers an offense when using where for constraint' do
9
- inspect_source <<-RUBY
9
+ offenses = inspect_source(<<~RUBY)
10
10
  add_unique_constraint %i[col_1 col_2], where: "state != 'deleted'"
11
11
  RUBY
12
12
 
13
- expect(cop.offenses.size).to eq(1)
13
+ expect(offenses.size).to eq(1)
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-sequel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothée Peignier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-03 00:00:00.000000000 Z
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -151,6 +151,7 @@ files:
151
151
  - lib/rubocop/cop/sequel/partial_constraint.rb
152
152
  - lib/rubocop/cop/sequel/save_changes.rb
153
153
  - lib/rubocop/sequel.rb
154
+ - lib/rubocop/sequel/version.rb
154
155
  - rubocop-sequel.gemspec
155
156
  - spec/rubocop/cop/sequel/column_default_spec.rb
156
157
  - spec/rubocop/cop/sequel/concurrent_index_spec.rb
@@ -159,10 +160,11 @@ files:
159
160
  - spec/rubocop/cop/sequel/partial_constraint_spec.rb
160
161
  - spec/rubocop/cop/sequel/save_changes_spec.rb
161
162
  - spec/spec_helper.rb
162
- homepage: https://github.com/rubocop-hq/rubocop-sequel
163
+ homepage: https://github.com/rubocop/rubocop-sequel
163
164
  licenses:
164
165
  - MIT
165
- metadata: {}
166
+ metadata:
167
+ rubygems_mfa_required: 'true'
166
168
  post_install_message:
167
169
  rdoc_options: []
168
170
  require_paths:
@@ -178,15 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
180
  - !ruby/object:Gem::Version
179
181
  version: '0'
180
182
  requirements: []
181
- rubygems_version: 3.2.3
183
+ rubygems_version: 3.1.6
182
184
  signing_key:
183
185
  specification_version: 4
184
186
  summary: A Sequel plugin for RuboCop
185
- test_files:
186
- - spec/rubocop/cop/sequel/column_default_spec.rb
187
- - spec/rubocop/cop/sequel/concurrent_index_spec.rb
188
- - spec/rubocop/cop/sequel/json_column_spec.rb
189
- - spec/rubocop/cop/sequel/migration_name_spec.rb
190
- - spec/rubocop/cop/sequel/partial_constraint_spec.rb
191
- - spec/rubocop/cop/sequel/save_changes_spec.rb
192
- - spec/spec_helper.rb
187
+ test_files: []