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 +4 -4
- data/README.md +1 -1
- data/lib/rubocop/cop/sequel/column_default.rb +1 -0
- data/lib/rubocop/cop/sequel/concurrent_index.rb +1 -0
- data/lib/rubocop/cop/sequel/json_column.rb +1 -0
- data/lib/rubocop/cop/sequel/partial_constraint.rb +3 -2
- data/lib/rubocop/cop/sequel/save_changes.rb +1 -0
- data/lib/rubocop/sequel/version.rb +10 -0
- data/lib/rubocop-sequel.rb +1 -0
- data/rubocop-sequel.gemspec +3 -3
- data/spec/rubocop/cop/sequel/partial_constraint_spec.rb +2 -2
- metadata +8 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9946d5d75823d8bf843b76fcf363080f6fe7b89898a5cd83fda2c2474f75e188
|
|
4
|
+
data.tar.gz: ca925b88e4778ae0a255f24d3ab03c1802989d64943b3b74128c305fb99405d5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f68ad1bd6c68025ed7d974e4d68f900583bfa9e7136247be140930a9d40a5c6a22c6be9a671c6f3042d6a0ce3655c9932405c0d4ce0900a1e4a9d991f425aff0
|
|
7
|
+
data.tar.gz: 7f020ea08ebc0f993e4809ff47c240663ca4b0d4854fafb28773fc25d16f210cabf435e194ee3c2d4bf7dd5acc7c1bc2a3364de7ca0501bc2f412d7383bbbac4
|
data/README.md
CHANGED
|
@@ -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 <
|
|
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
|
|
18
|
+
add_offense(node.loc.selector, message: MSG)
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
data/lib/rubocop-sequel.rb
CHANGED
data/rubocop-sequel.gemspec
CHANGED
|
@@ -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
|
|
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.
|
|
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
|
|
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(
|
|
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.
|
|
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:
|
|
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
|
|
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.
|
|
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: []
|