rubocop-rails 2.5.1 → 2.5.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec32a9f0b296ef0a59bb3e93086ce5092ef18f49f546643588244503b94c7bc
|
4
|
+
data.tar.gz: c1f270a92e19d8403896420bb6dfb5b58a389e8042f16513c3efd8aaf6ab0abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
@@ -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)
|
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.
|
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-
|
13
|
+
date: 2020-04-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|