rubocop-rails 2.5.1 → 2.5.2

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: 2ad01eddf8f7245cdbba5eef8c2c7f73656707bde4dd3e1dc08e6604284e2c5b
4
- data.tar.gz: b4542ee0b28af39310b2fbf6e5b7e276249144050edf90208036b8b9dafe64da
3
+ metadata.gz: dec32a9f0b296ef0a59bb3e93086ce5092ef18f49f546643588244503b94c7bc
4
+ data.tar.gz: c1f270a92e19d8403896420bb6dfb5b58a389e8042f16513c3efd8aaf6ab0abb
5
5
  SHA512:
6
- metadata.gz: d3c643803fcbeb378b60bf8c811bda542445d03ded462975d2c89f3a49e3f36b0c4f46468adbbbc768923a4f01545e5b03159ee2a675687bd49906b81dd28912
7
- data.tar.gz: a471837a24adbb346243c23a2e88d0daceb2214632e7b92fc075b4936897fec91b06cb56d6131e65ea9716a643f3a635317357053364f29f6a7663ccefd62f32
6
+ metadata.gz: 74cfd98f2b2506d2079e034f3e973d07eb3295b247b5dd48ccaebb5bc3461e4ad1c1bc6a2935b3b978203ecbe5cd1db43d616095c0b9a673dfc2222ff2aa79cf
7
+ data.tar.gz: 3b48ca258cf1c4910417b2cadcf24244da5ac2d837a730cb584c0096e66b3688e6115ed93d22b619fb6224f84fc23eff250852498c4e6cab5c7f02ac3943fe71
@@ -14,6 +14,23 @@ module RuboCop
14
14
  (send nil? :belongs_to {str sym} ...)
15
15
  PATTERN
16
16
 
17
+ def external_dependency_checksum
18
+ if defined?(@external_dependency_checksum)
19
+ return @external_dependency_checksum
20
+ end
21
+
22
+ schema_path = RuboCop::Rails::SchemaLoader.db_schema_path
23
+ return nil if schema_path.nil?
24
+
25
+ schema_code = File.read(schema_path)
26
+
27
+ @external_dependency_checksum ||= Digest::SHA1.hexdigest(schema_code)
28
+ end
29
+
30
+ def schema
31
+ RuboCop::Rails::SchemaLoader.load(target_ruby_version)
32
+ end
33
+
17
34
  def table_name(class_node)
18
35
  table_name = find_set_table_name(class_node).to_a.last&.first_argument
19
36
  return table_name.value.to_s if table_name
@@ -149,10 +149,6 @@ module RuboCop
149
149
  end
150
150
  end
151
151
  end
152
-
153
- def schema
154
- RuboCop::Rails::SchemaLoader.load(target_ruby_version)
155
- end
156
152
  end
157
153
  end
158
154
  end
@@ -24,16 +24,6 @@ module RuboCop
24
24
  remove_instance_variable(:@schema)
25
25
  end
26
26
 
27
- private
28
-
29
- def load!(target_ruby_version)
30
- path = db_schema_path
31
- return unless path
32
-
33
- ast = parse(path, target_ruby_version)
34
- Schema.new(ast)
35
- end
36
-
37
27
  def db_schema_path
38
28
  path = Pathname.pwd
39
29
  until path.root?
@@ -46,6 +36,16 @@ module RuboCop
46
36
  nil
47
37
  end
48
38
 
39
+ private
40
+
41
+ def load!(target_ruby_version)
42
+ path = db_schema_path
43
+ return unless path
44
+
45
+ ast = parse(path, target_ruby_version)
46
+ Schema.new(ast)
47
+ end
48
+
49
49
  def parse(path, target_ruby_version)
50
50
  klass_name = :"Ruby#{target_ruby_version.to_s.sub('.', '')}"
51
51
  klass = ::Parser.const_get(klass_name)
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Rails
5
5
  # This module holds the RuboCop Rails version information.
6
6
  module Version
7
- STRING = '2.5.1'
7
+ STRING = '2.5.2'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-04-02 00:00:00.000000000 Z
13
+ date: 2020-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport