rubocop-sequel 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2050311f0798d72d81f8af6463c505abbed45460abf2c6b764b90a57fc4926f
|
4
|
+
data.tar.gz: 9b2dac1b9e05c5d47e8ce64386357c3fd1f73a46cd057e6e598923508e6d3bb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c86a24a2f3d7c72259ca824b7f3f49c09307f81aacca96b1ca265a6ac63038afa50355542b2896e058a0b04b3b4f3ba897dcbf824026f9d8be2e7c7255c042
|
7
|
+
data.tar.gz: ba02ad3c73e81769d1bcf5642f15b02ba006319d507566a5ad2fabfa49681c006b0305d72ea76a7393b273a3b5434aec3baec20093deb8b43f4258591a7086e3
|
@@ -4,7 +4,7 @@ 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
9
|
|
10
10
|
def_node_matcher :add_partial_constraint?, <<-MATCHER
|
@@ -14,7 +14,7 @@ module RuboCop
|
|
14
14
|
def on_send(node)
|
15
15
|
return unless add_partial_constraint?(node)
|
16
16
|
|
17
|
-
add_offense(node
|
17
|
+
add_offense(node.loc.selector, message: MSG)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/rubocop-sequel.gemspec
CHANGED
@@ -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
|