rubocop-github 0.5.0 → 0.6.0

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
  SHA1:
3
- metadata.gz: 4850486ea03d870f6aead0f4a2517fb0b2276d65
4
- data.tar.gz: b9b7f0edd11e56766593cc80ef423982df6604e8
3
+ metadata.gz: 6af726432cd153410483cfe93e2f502d7e98c93f
4
+ data.tar.gz: 6951ded262807d7ac3cc1fd139302ea5eec60eb5
5
5
  SHA512:
6
- metadata.gz: 7ecedba5945565a11735da85a501aa8fa45d855eba35d1a2d5cfd0e916dd937f59c44610379aff891852f253f2e12b6d5e2daf2de7182040b9599e5739a807e2
7
- data.tar.gz: 86a229e24c43620c4f2c56acc005702f8102839744658627689054e6f9b5d86ef507431e9961cce13af4b7b616ac0d584dbe0db456f292fcb1cff1c26f5a5180
6
+ metadata.gz: 763fe41dba94fcbb0d400fb742fef4b9e9ce3370a32f254184012eba36a3fb6b887ec0692944d9eb41025d15ae5f8184774b114e748c68966842daa1381be131
7
+ data.tar.gz: f9cbb9f51e5b9d0436a9cad3c1afa33b62ec5610e822ca152cdad3d1d4506af4566fe2b2d4afec6b1b4cd42399197ffd0a1e55e943b2d054314dd8623247b6ac
@@ -9,6 +9,57 @@ Bundler/DuplicatedGem:
9
9
  Bundler/OrderedGems:
10
10
  Enabled: true
11
11
 
12
+ Layout/BlockEndNewline:
13
+ Enabled: true
14
+
15
+ Layout/EndOfLine:
16
+ Enabled: true
17
+
18
+ Layout/InitialIndentation:
19
+ Enabled: true
20
+
21
+ Layout/SpaceAfterColon:
22
+ Enabled: true
23
+
24
+ Layout/SpaceAfterComma:
25
+ Enabled: true
26
+
27
+ Layout/SpaceAfterMethodName:
28
+ Enabled: true
29
+
30
+ Layout/SpaceAfterNot:
31
+ Enabled: true
32
+
33
+ Layout/SpaceAfterSemicolon:
34
+ Enabled: true
35
+
36
+ Layout/SpaceAroundBlockParameters:
37
+ Enabled: true
38
+
39
+ Layout/SpaceAroundEqualsInParameterDefault:
40
+ Enabled: true
41
+
42
+ Layout/SpaceInsideArrayPercentLiteral:
43
+ Enabled: true
44
+
45
+ Layout/SpaceInsideBrackets:
46
+ Enabled: true
47
+
48
+ Layout/SpaceInsideParens:
49
+ Enabled: true
50
+
51
+ Layout/SpaceInsideRangeLiteral:
52
+ Enabled: true
53
+
54
+ Layout/Tab:
55
+ Enabled: true
56
+
57
+ Layout/TrailingBlankLines:
58
+ Enabled: true
59
+
60
+ Layout/TrailingWhitespace:
61
+ Enabled: true
62
+
12
63
  Lint/BlockAlignment:
13
64
  Enabled: true
14
65
 
@@ -42,15 +93,15 @@ Lint/ElseLayout:
42
93
  Lint/EmptyEnsure:
43
94
  Enabled: true
44
95
 
45
- Lint/EndInMethod:
46
- Enabled: true
47
-
48
96
  Lint/EmptyInterpolation:
49
97
  Enabled: true
50
98
 
51
99
  Lint/EndAlignment:
52
100
  Enabled: false
53
101
 
102
+ Lint/EndInMethod:
103
+ Enabled: true
104
+
54
105
  Lint/EnsureReturn:
55
106
  Enabled: true
56
107
 
@@ -60,14 +111,7 @@ Lint/FloatOutOfRange:
60
111
  Lint/FormatParameterMismatch:
61
112
  Enabled: true
62
113
 
63
- Style/HashSyntax:
64
- Enabled: true
65
- EnforcedStyle: ruby19
66
-
67
- Lint/InvalidCharacterLiteral:
68
- Enabled: true
69
-
70
- Lint/LiteralInCondition:
114
+ Lint/LiteralAsCondition:
71
115
  Enabled: true
72
116
 
73
117
  Lint/LiteralInInterpolation:
@@ -142,6 +186,18 @@ Metrics/ParameterLists:
142
186
  Metrics/PerceivedComplexity:
143
187
  Enabled: false
144
188
 
189
+ Naming/AsciiIdentifiers:
190
+ Enabled: true
191
+
192
+ Naming/ClassAndModuleCamelCase:
193
+ Enabled: true
194
+
195
+ Naming/FileName:
196
+ Enabled: true
197
+
198
+ Naming/MethodName:
199
+ Enabled: true
200
+
145
201
  Performance/CaseWhenSplat:
146
202
  Enabled: false
147
203
 
@@ -197,27 +253,18 @@ Security/Eval:
197
253
  Style/ArrayJoin:
198
254
  Enabled: true
199
255
 
200
- Style/AsciiIdentifiers:
201
- Enabled: true
202
-
203
256
  Style/BeginBlock:
204
257
  Enabled: true
205
258
 
206
259
  Style/BlockComments:
207
260
  Enabled: true
208
261
 
209
- Layout/BlockEndNewline:
210
- Enabled: true
211
-
212
262
  Style/CaseEquality:
213
263
  Enabled: true
214
264
 
215
265
  Style/CharacterLiteral:
216
266
  Enabled: true
217
267
 
218
- Style/ClassAndModuleCamelCase:
219
- Enabled: true
220
-
221
268
  Style/ClassMethods:
222
269
  Enabled: true
223
270
 
@@ -230,12 +277,6 @@ Style/DefWithParentheses:
230
277
  Style/EndBlock:
231
278
  Enabled: true
232
279
 
233
- Layout/EndOfLine:
234
- Enabled: true
235
-
236
- Style/FileName:
237
- Enabled: true
238
-
239
280
  Style/FlipFlop:
240
281
  Enabled: true
241
282
 
@@ -245,8 +286,9 @@ Style/For:
245
286
  Style/FrozenStringLiteralComment:
246
287
  Enabled: true
247
288
 
248
- Layout/InitialIndentation:
289
+ Style/HashSyntax:
249
290
  Enabled: true
291
+ EnforcedStyle: ruby19
250
292
 
251
293
  Style/LambdaCall:
252
294
  Enabled: true
@@ -257,9 +299,6 @@ Style/MethodCallWithoutArgsParentheses:
257
299
  Style/MethodDefParentheses:
258
300
  Enabled: true
259
301
 
260
- Style/MethodName:
261
- Enabled: true
262
-
263
302
  Style/MultilineIfThen:
264
303
  Enabled: true
265
304
 
@@ -272,51 +311,9 @@ Style/Not:
272
311
  Style/OneLineConditional:
273
312
  Enabled: true
274
313
 
275
- Layout/SpaceAfterMethodName:
276
- Enabled: true
277
-
278
- Layout/SpaceAfterColon:
279
- Enabled: true
280
-
281
- Layout/SpaceAfterComma:
282
- Enabled: true
283
-
284
- Layout/SpaceAfterNot:
285
- Enabled: true
286
-
287
- Layout/SpaceAfterSemicolon:
288
- Enabled: true
289
-
290
- Layout/SpaceAroundBlockParameters:
291
- Enabled: true
292
-
293
- Layout/SpaceAroundEqualsInParameterDefault:
294
- Enabled: true
295
-
296
- Layout/SpaceInsideArrayPercentLiteral:
297
- Enabled: true
298
-
299
- Layout/SpaceInsideBrackets:
300
- Enabled: true
301
-
302
- Layout/SpaceInsideParens:
303
- Enabled: true
304
-
305
- Layout/SpaceInsideRangeLiteral:
306
- Enabled: true
307
-
308
314
  Style/StabbyLambdaParentheses:
309
315
  Enabled: true
310
316
 
311
317
  Style/StringLiterals:
312
318
  Enabled: true
313
319
  EnforcedStyle: double_quotes
314
-
315
- Layout/Tab:
316
- Enabled: true
317
-
318
- Layout/TrailingBlankLines:
319
- Enabled: true
320
-
321
- Layout/TrailingWhitespace:
322
- Enabled: true
@@ -9,18 +9,18 @@ module RuboCop
9
9
  MSG = "Models should subclass from ApplicationRecord"
10
10
 
11
11
  def_node_matcher :active_record_base_const?, <<-PATTERN
12
- (const (const nil :ActiveRecord) :Base)
12
+ (const (const nil? :ActiveRecord) :Base)
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :application_record_const?, <<-PATTERN
16
- (const nil :ApplicationRecord)
16
+ (const nil? :ApplicationRecord)
17
17
  PATTERN
18
18
 
19
19
  def on_class(node)
20
20
  klass, superclass, _ = *node
21
21
 
22
22
  if active_record_base_const?(superclass) && !(application_record_const?(klass))
23
- add_offense(superclass, :expression)
23
+ add_offense(superclass, location: :expression)
24
24
  end
25
25
  end
26
26
  end
@@ -9,11 +9,11 @@ module RuboCop
9
9
  MSG = "Prefer `render` with string instead of symbol"
10
10
 
11
11
  def_node_matcher :render_sym?, <<-PATTERN
12
- (send nil :render $(sym _))
12
+ (send nil? :render $(sym _))
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :render_with_options?, <<-PATTERN
16
- (send nil :render (hash $...))
16
+ (send nil? :render (hash $...))
17
17
  PATTERN
18
18
 
19
19
  def_node_matcher :action_key?, <<-PATTERN
@@ -22,11 +22,11 @@ module RuboCop
22
22
 
23
23
  def on_send(node)
24
24
  if sym_node = render_sym?(node)
25
- add_offense(sym_node, :expression)
25
+ add_offense(sym_node, location: :expression)
26
26
  elsif option_pairs = render_with_options?(node)
27
27
  option_pairs.each do |pair|
28
28
  if sym_node = action_key?(pair)
29
- add_offense(sym_node, :expression)
29
+ add_offense(sym_node, location: :expression)
30
30
  end
31
31
  end
32
32
  end
@@ -9,19 +9,19 @@ module RuboCop
9
9
  MSG = "render must be used with a string literal"
10
10
 
11
11
  def_node_matcher :literal?, <<-PATTERN
12
- ({str sym true false nil} ...)
12
+ ({str sym true false nil?} ...)
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :render?, <<-PATTERN
16
- (send nil :render ...)
16
+ (send nil? :render ...)
17
17
  PATTERN
18
18
 
19
19
  def_node_matcher :render_literal?, <<-PATTERN
20
- (send nil :render ({str sym} $_) $...)
20
+ (send nil? :render ({str sym} $_) $...)
21
21
  PATTERN
22
22
 
23
23
  def_node_matcher :render_with_options?, <<-PATTERN
24
- (send nil :render (hash $...))
24
+ (send nil? :render (hash $...))
25
25
  PATTERN
26
26
 
27
27
  def_node_matcher :ignore_key?, <<-PATTERN
@@ -73,19 +73,19 @@ module RuboCop
73
73
 
74
74
  if template_node = option_pairs.map { |pair| template_key?(pair) }.compact.first
75
75
  if !literal?(template_node)
76
- add_offense(node, :expression)
76
+ add_offense(node, location: :expression)
77
77
  end
78
78
  else
79
- add_offense(node, :expression)
79
+ add_offense(node, location: :expression)
80
80
  end
81
81
 
82
82
  if layout_node = option_pairs.map { |pair| layout_key?(pair) }.compact.first
83
83
  if !literal?(layout_node)
84
- add_offense(node, :expression)
84
+ add_offense(node, location: :expression)
85
85
  end
86
86
  end
87
87
  else
88
- add_offense(node, :expression)
88
+ add_offense(node, location: :expression)
89
89
  end
90
90
  end
91
91
  end
@@ -7,15 +7,15 @@ module RuboCop
7
7
  module GitHub
8
8
  class RailsControllerRenderPathsExist < Cop
9
9
  def_node_matcher :render?, <<-PATTERN
10
- (send nil :render $...)
10
+ (send nil? :render $...)
11
11
  PATTERN
12
12
 
13
13
  def_node_matcher :render_str?, <<-PATTERN
14
- (send nil :render $({str sym} $_) ...)
14
+ (send nil? :render $({str sym} $_) ...)
15
15
  PATTERN
16
16
 
17
17
  def_node_matcher :render_options?, <<-PATTERN
18
- (send nil :render (hash $...))
18
+ (send nil? :render (hash $...))
19
19
  PATTERN
20
20
 
21
21
  def_node_matcher :render_key?, <<-PATTERN
@@ -28,7 +28,7 @@ module RuboCop
28
28
  if args = render_str?(node)
29
29
  node, path = args
30
30
  unless resolve_template(path.to_s)
31
- add_offense(node, :expression, "Template could not be found")
31
+ add_offense(node, location: :expression, message: "Template could not be found")
32
32
  end
33
33
  elsif pairs = render_options?(node)
34
34
  if pair = pairs.detect { |p| render_key?(p) }
@@ -37,11 +37,11 @@ module RuboCop
37
37
  case key
38
38
  when :action, :template
39
39
  unless resolve_template(path.to_s)
40
- add_offense(node, :expression, "Template could not be found")
40
+ add_offense(node, location: :expression, message: "Template could not be found")
41
41
  end
42
42
  when :partial
43
43
  unless resolve_partial(path.to_s)
44
- add_offense(node, :expression, "Partial template could not be found")
44
+ add_offense(node, location: :expression, message: "Partial template could not be found")
45
45
  end
46
46
  end
47
47
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  MSG = "Prefer `render` template shorthand"
10
10
 
11
11
  def_node_matcher :render_with_options?, <<-PATTERN
12
- (send nil :render (hash $...))
12
+ (send nil? :render (hash $...))
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :action_key?, <<-PATTERN
@@ -40,7 +40,7 @@ module RuboCop
40
40
  @autocorrect[node] = lambda do |corrector|
41
41
  corrector.replace(node.source_range, corrected_source)
42
42
  end
43
- add_offense(node, :expression, "Use `#{corrected_source}` instead")
43
+ add_offense(node, location: :expression, message: "Use `#{corrected_source}` instead")
44
44
  end
45
45
  end
46
46
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  MSG = "Avoid `render inline:`"
10
10
 
11
11
  def_node_matcher :render_with_options?, <<-PATTERN
12
- (send nil :render (hash $...))
12
+ (send nil? :render (hash $...))
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :inline_key?, <<-PATTERN
@@ -19,7 +19,7 @@ module RuboCop
19
19
  def on_send(node)
20
20
  if option_pairs = render_with_options?(node)
21
21
  if option_pairs.detect { |pair| inline_key?(pair) }
22
- add_offense(node, :expression)
22
+ add_offense(node, location: :expression)
23
23
  end
24
24
  end
25
25
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  MSG = "Avoid `render object:`"
10
10
 
11
11
  def_node_matcher :render_with_options?, <<-PATTERN
12
- (send nil :render (hash $...) ...)
12
+ (send nil? :render (hash $...) ...)
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :partial_key?, <<-PATTERN
@@ -34,9 +34,9 @@ module RuboCop
34
34
  if partial_name.children[0].is_a?(String)
35
35
  suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`"
36
36
  end
37
- add_offense(node, :expression, "Avoid `render object:`#{suggestion}")
37
+ add_offense(node, location: :expression, message: "Avoid `render object:`#{suggestion}")
38
38
  when :collection, :spacer_template
39
- add_offense(node, :expression, "Avoid `render collection:`")
39
+ add_offense(node, location: :expression, message: "Avoid `render collection:`")
40
40
  end
41
41
  end
42
42
  end
@@ -9,19 +9,19 @@ module RuboCop
9
9
  MSG = "render must be used with a string literal"
10
10
 
11
11
  def_node_matcher :literal?, <<-PATTERN
12
- ({str sym true false nil} ...)
12
+ ({str sym true false nil?} ...)
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :render?, <<-PATTERN
16
- (send nil :render $...)
16
+ (send nil? :render $...)
17
17
  PATTERN
18
18
 
19
19
  def_node_matcher :render_literal?, <<-PATTERN
20
- (send nil :render ({str sym} $_) $...)
20
+ (send nil? :render ({str sym} $_) $...)
21
21
  PATTERN
22
22
 
23
23
  def_node_matcher :render_with_options?, <<-PATTERN
24
- (send nil :render (hash $...) ...)
24
+ (send nil? :render (hash $...) ...)
25
25
  PATTERN
26
26
 
27
27
  def_node_matcher :ignore_key?, <<-PATTERN
@@ -49,13 +49,13 @@ module RuboCop
49
49
 
50
50
  if partial_node = option_pairs.map { |pair| partial_key?(pair) }.compact.first
51
51
  if !literal?(partial_node)
52
- add_offense(node, :expression)
52
+ add_offense(node, location: :expression)
53
53
  end
54
54
  else
55
- add_offense(node, :expression)
55
+ add_offense(node, location: :expression)
56
56
  end
57
57
  else
58
- add_offense(node, :expression)
58
+ add_offense(node, location: :expression)
59
59
  end
60
60
  end
61
61
  end
@@ -7,15 +7,15 @@ module RuboCop
7
7
  module GitHub
8
8
  class RailsViewRenderPathsExist < Cop
9
9
  def_node_matcher :render?, <<-PATTERN
10
- (send nil :render $...)
10
+ (send nil? :render $...)
11
11
  PATTERN
12
12
 
13
13
  def_node_matcher :render_str?, <<-PATTERN
14
- (send nil :render $(str $_) ...)
14
+ (send nil? :render $(str $_) ...)
15
15
  PATTERN
16
16
 
17
17
  def_node_matcher :render_options?, <<-PATTERN
18
- (send nil :render (hash $...))
18
+ (send nil? :render (hash $...))
19
19
  PATTERN
20
20
 
21
21
  def_node_matcher :partial_key?, <<-PATTERN
@@ -28,14 +28,14 @@ module RuboCop
28
28
  if args = render_str?(node)
29
29
  node, path = args
30
30
  unless resolve_partial(path.to_s)
31
- add_offense(node, :expression, "Partial template could not be found")
31
+ add_offense(node, location: :expression, message: "Partial template could not be found")
32
32
  end
33
33
  elsif pairs = render_options?(node)
34
34
  if pair = pairs.detect { |p| partial_key?(p) }
35
35
  node, path = partial_key?(pair)
36
36
 
37
37
  unless resolve_partial(path.to_s)
38
- add_offense(node, :expression, "Partial template could not be found")
38
+ add_offense(node, location: :expression, message: "Partial template could not be found")
39
39
  end
40
40
  end
41
41
  end
@@ -9,7 +9,7 @@ module RuboCop
9
9
  MSG = "Prefer `render` partial shorthand"
10
10
 
11
11
  def_node_matcher :render_with_options?, <<-PATTERN
12
- (send nil :render (hash $...))
12
+ (send nil? :render (hash $...))
13
13
  PATTERN
14
14
 
15
15
  def_node_matcher :partial_key?, <<-PATTERN
@@ -26,9 +26,9 @@ module RuboCop
26
26
  locals_key = option_pairs.map { |pair| locals_key?(pair) }.compact.first
27
27
 
28
28
  if option_pairs.length == 1 && partial_key
29
- add_offense(node, :expression, "Use `render #{partial_key.source}` instead")
29
+ add_offense(node, location: :expression, message: "Use `render #{partial_key.source}` instead")
30
30
  elsif option_pairs.length == 2 && partial_key && locals_key
31
- add_offense(node, :expression, "Use `render #{partial_key.source}, #{locals_key.source}` instead")
31
+ add_offense(node, location: :expression, message: "Use `render #{partial_key.source}, #{locals_key.source}` instead")
32
32
  end
33
33
  end
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-22 00:00:00.000000000 Z
11
+ date: 2017-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.49'
19
+ version: '0.51'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.49'
26
+ version: '0.51'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionview
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.11
128
+ rubygems_version: 2.6.12
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: RuboCop GitHub