momocop 0.1.8 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/lib/momocop/version.rb +1 -1
- data/lib/rubocop/cop/momocop/factory_bot_class_existence.rb +0 -1
- data/lib/rubocop/cop/momocop/factory_bot_missing_associations.rb +1 -1
- data/lib/rubocop/cop/momocop/factory_bot_missing_properties.rb +1 -1
- data/lib/rubocop/cop/momocop/factory_bot_property_order.rb +20 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a6e94746e124b9b4b7faa9f87effebbbe8f75f7a23ac9f80ee71ef0fee674c
|
4
|
+
data.tar.gz: e32490d4c0fc3e2f02d96ad154db9ff52ef17f56ba993ac7260bc04169fa0e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aae3b5142feb84c7bc741a0d988e715c9101fc16f362e71325abbe330a7952e7ccaaa1ec99f260227b5e14c967341c57a3855810da3034d12e04dadb0c2dbaa
|
7
|
+
data.tar.gz: 31a58eb60a8f1cd43dadd62d0be672620157070f00b441171db634fdd24d65b0b6967c75cf743bff77a1ae5baa4776a2d84147f7b8b99ca86f5e5087effd019e
|
data/.rubocop.yml
CHANGED
data/lib/momocop/version.rb
CHANGED
@@ -47,7 +47,7 @@ module RuboCop
|
|
47
47
|
unless block_node
|
48
48
|
add_offense(node, message: MSG) do |corrector|
|
49
49
|
indentation = ' ' * node.loc.column
|
50
|
-
corrector.
|
50
|
+
corrector.replace(node.source_range, "#{node.source} do\n#{indentation}end")
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -54,7 +54,7 @@ module RuboCop
|
|
54
54
|
unless block_node
|
55
55
|
add_offense(node, message: MSG) do |corrector|
|
56
56
|
indentation = ' ' * node.loc.column
|
57
|
-
corrector.
|
57
|
+
corrector.replace(node.source_range, "#{node.source} do\n#{indentation}end")
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -55,7 +55,9 @@ module RuboCop
|
|
55
55
|
|
56
56
|
sections =
|
57
57
|
entire_definitions
|
58
|
-
.slice_when { |a, b|
|
58
|
+
.slice_when { |a, b|
|
59
|
+
(range_with_comments(b).first_line - range_with_comments(a).last_line) > 1
|
60
|
+
}
|
59
61
|
.select { |definitions| definitions.size >= 2 }
|
60
62
|
|
61
63
|
sections.each do |definitions|
|
@@ -85,14 +87,28 @@ module RuboCop
|
|
85
87
|
|
86
88
|
private def defined_properties(block_node)
|
87
89
|
body_node = block_node&.children&.last
|
88
|
-
|
90
|
+
|
91
|
+
# empty block
|
92
|
+
return [] unless body_node
|
93
|
+
|
94
|
+
# begin
|
95
|
+
if body_node.begin_type?
|
96
|
+
body_node&.children&.select { |node| definition_node?(node) } || []
|
97
|
+
# block
|
98
|
+
elsif body_node.send_type? && definition_node?(body_node)
|
99
|
+
[body_node]
|
100
|
+
else
|
101
|
+
[]
|
102
|
+
end
|
89
103
|
end
|
90
104
|
|
105
|
+
RUBOCOP_HELPER_METHODS = %i[trait transient before after].freeze
|
106
|
+
|
91
107
|
private def definition_node?(node)
|
92
108
|
if node.send_type?
|
93
|
-
return node.method_name
|
109
|
+
return !RUBOCOP_HELPER_METHODS.include?(node.method_name)
|
94
110
|
elsif node.block_type? && node.children.first.send_type?
|
95
|
-
return node.children.first.method_name
|
111
|
+
return !RUBOCOP_HELPER_METHODS.include?(node.children.first.method_name)
|
96
112
|
end
|
97
113
|
|
98
114
|
return false
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: momocop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- supermomonga
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.49.0
|
34
34
|
type: :runtime
|
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: 1.49.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|