rubocop-canon 0.2.1 → 0.2.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 +4 -4
- data/lib/rubocop/canon/version.rb +1 -1
- data/lib/rubocop/cop/canon/declaration_groups.rb +11 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c0d98429626224c644766d7ef86c951721e1cacb1ed1f2ca8399088dc7e83b26
|
|
4
|
+
data.tar.gz: 7f07b6c9c8a8005d3403a2ec8fbdd01e9048a142bf2cbd16fd0274166f3808bf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59e81cc7a968cdc8bb061621f7526ee386df07b354d75b305010c5290d52286e8d5a4906f24c41aaad28cba648288d6e675c45d415edd2d2569ad6d53de4337a
|
|
7
|
+
data.tar.gz: 00a20f3e22afc400098761be958ffc1d1bbc8eddffbb9738969037b42dc4ca0babcaa0d9c54a21ba093142d5c64b4a40b0572affa30a17d8b0a0d2cbf6ac1ed9
|
|
@@ -12,10 +12,10 @@ module RuboCop
|
|
|
12
12
|
# cop says nothing about a method name it has not been given, so a DSL
|
|
13
13
|
# it does not know stays as its author wrote it.
|
|
14
14
|
#
|
|
15
|
-
# A
|
|
16
|
-
#
|
|
17
|
-
# has not been told about — an unlisted method
|
|
18
|
-
# leaves alone.
|
|
15
|
+
# A declaration spanning several lines, and any block, is a group of one
|
|
16
|
+
# whatever it calls, so it always stands apart from its neighbours.
|
|
17
|
+
# Everything else the cop has not been told about — an unlisted method
|
|
18
|
+
# name on one line, a constant — it leaves alone.
|
|
19
19
|
#
|
|
20
20
|
# @example GroupedMethods: [[belongs_to, has_many], [validate, validates]]
|
|
21
21
|
# # bad
|
|
@@ -112,7 +112,13 @@ module RuboCop
|
|
|
112
112
|
end
|
|
113
113
|
|
|
114
114
|
def standalone?(node)
|
|
115
|
-
STANDALONE_TYPES.include?(node.type)
|
|
115
|
+
return true if STANDALONE_TYPES.include?(node.type)
|
|
116
|
+
|
|
117
|
+
multiline?(node)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def multiline?(node)
|
|
121
|
+
node.first_line != node.last_line
|
|
116
122
|
end
|
|
117
123
|
|
|
118
124
|
def group_key(node)
|