rubocop-sequel 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/actions.yml +0 -1
- data/.rubocop.yml +2 -1
- data/lib/rubocop-sequel.rb +1 -0
- data/lib/rubocop/cop/sequel/partial_constraint.rb +22 -0
- data/lib/rubocop/cop/sequel/save_changes.rb +1 -1
- data/rubocop-sequel.gemspec +5 -4
- data/spec/rubocop/cop/sequel/partial_constraint_spec.rb +15 -0
- metadata +26 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 260beb7a94809075be127b7eac43b03b1acc661038009ea8c189bb91f543bdf0
|
4
|
+
data.tar.gz: '0815a252def8ee363d59bdc19f8c317b8f68bf9a89a50ed15bd79730bbc9fa60'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa012f6644b9360e4d3d8c3d9ceb1b00165bab142f6dab7521d7289a8caa09704b6d27224cae6490b9a86067a7058bd657ac59f975c51e242807d65243678b3a
|
7
|
+
data.tar.gz: 19aa510cdf0b8ec211d1bca4377652afa877a7c4e52d8804a45099008d0a763c008dac616b15e5074e71bbe98800d5c3d54f98fde5dc1fd29600ca197a6233ea
|
data/.rubocop.yml
CHANGED
data/lib/rubocop-sequel.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RuboCop
|
4
|
+
module Cop
|
5
|
+
module Sequel
|
6
|
+
# PartialConstraint looks for missed usage of partial indexes.
|
7
|
+
class PartialConstraint < Cop
|
8
|
+
MSG = "Constraint can't be partial, use where argument with index"
|
9
|
+
|
10
|
+
def_node_matcher :add_partial_constraint?, <<-MATCHER
|
11
|
+
(send _ :add_unique_constraint ... (hash (pair (sym :where) _)))
|
12
|
+
MATCHER
|
13
|
+
|
14
|
+
def on_send(node)
|
15
|
+
return unless add_partial_constraint?(node)
|
16
|
+
|
17
|
+
add_offense(node, location: :selector, message: MSG)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/rubocop-sequel.gemspec
CHANGED
@@ -13,16 +13,17 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = 'rubocop-sequel'
|
15
15
|
gem.require_paths = ['lib']
|
16
|
-
gem.version = '0.
|
16
|
+
gem.version = '0.3.0'
|
17
17
|
|
18
|
-
gem.required_ruby_version = '>= 2.
|
18
|
+
gem.required_ruby_version = '>= 2.5'
|
19
19
|
|
20
20
|
gem.add_runtime_dependency 'rubocop', '~> 1.0'
|
21
21
|
|
22
|
-
gem.add_development_dependency 'rake', '~>
|
22
|
+
gem.add_development_dependency 'rake', '~> 13.0.6'
|
23
23
|
gem.add_development_dependency 'rspec', '~> 3.7'
|
24
|
+
gem.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
24
25
|
gem.add_development_dependency 'rubocop-rspec', '~> 2.0'
|
25
|
-
gem.add_development_dependency 'sequel', '~>
|
26
|
+
gem.add_development_dependency 'sequel', '~> 5.47'
|
26
27
|
gem.add_development_dependency 'simplecov', '~> 0.16'
|
27
28
|
gem.add_development_dependency 'sqlite3', '~> 1.3', '>= 1.3.12'
|
28
29
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe RuboCop::Cop::Sequel::PartialConstraint do
|
6
|
+
subject(:cop) { described_class.new }
|
7
|
+
|
8
|
+
it 'registers an offense when using where for constraint' do
|
9
|
+
inspect_source <<-RUBY
|
10
|
+
add_unique_constraint %i[col_1 col_2], where: "state != 'deleted'"
|
11
|
+
RUBY
|
12
|
+
|
13
|
+
expect(cop.offenses.size).to eq(1)
|
14
|
+
end
|
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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2021-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 13.0.6
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 13.0.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.6.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.6.0
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rubocop-rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +86,14 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '5.47'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '5.47'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,6 +135,7 @@ executables: []
|
|
121
135
|
extensions: []
|
122
136
|
extra_rdoc_files: []
|
123
137
|
files:
|
138
|
+
- ".github/dependabot.yml"
|
124
139
|
- ".github/workflows/actions.yml"
|
125
140
|
- ".gitignore"
|
126
141
|
- ".rspec"
|
@@ -133,6 +148,7 @@ files:
|
|
133
148
|
- lib/rubocop/cop/sequel/concurrent_index.rb
|
134
149
|
- lib/rubocop/cop/sequel/json_column.rb
|
135
150
|
- lib/rubocop/cop/sequel/migration_name.rb
|
151
|
+
- lib/rubocop/cop/sequel/partial_constraint.rb
|
136
152
|
- lib/rubocop/cop/sequel/save_changes.rb
|
137
153
|
- lib/rubocop/sequel.rb
|
138
154
|
- rubocop-sequel.gemspec
|
@@ -140,6 +156,7 @@ files:
|
|
140
156
|
- spec/rubocop/cop/sequel/concurrent_index_spec.rb
|
141
157
|
- spec/rubocop/cop/sequel/json_column_spec.rb
|
142
158
|
- spec/rubocop/cop/sequel/migration_name_spec.rb
|
159
|
+
- spec/rubocop/cop/sequel/partial_constraint_spec.rb
|
143
160
|
- spec/rubocop/cop/sequel/save_changes_spec.rb
|
144
161
|
- spec/spec_helper.rb
|
145
162
|
homepage: https://github.com/rubocop-hq/rubocop-sequel
|
@@ -154,14 +171,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
171
|
requirements:
|
155
172
|
- - ">="
|
156
173
|
- !ruby/object:Gem::Version
|
157
|
-
version: '2.
|
174
|
+
version: '2.5'
|
158
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
176
|
requirements:
|
160
177
|
- - ">="
|
161
178
|
- !ruby/object:Gem::Version
|
162
179
|
version: '0'
|
163
180
|
requirements: []
|
164
|
-
rubygems_version: 3.
|
181
|
+
rubygems_version: 3.2.3
|
165
182
|
signing_key:
|
166
183
|
specification_version: 4
|
167
184
|
summary: A Sequel plugin for RuboCop
|
@@ -170,5 +187,6 @@ test_files:
|
|
170
187
|
- spec/rubocop/cop/sequel/concurrent_index_spec.rb
|
171
188
|
- spec/rubocop/cop/sequel/json_column_spec.rb
|
172
189
|
- spec/rubocop/cop/sequel/migration_name_spec.rb
|
190
|
+
- spec/rubocop/cop/sequel/partial_constraint_spec.rb
|
173
191
|
- spec/rubocop/cop/sequel/save_changes_spec.rb
|
174
192
|
- spec/spec_helper.rb
|