rubocop-standard 3.2.0 → 4.0.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
  SHA256:
3
- metadata.gz: 9fc53357bb286c2fc2b4ca34bb0df1efb0906967b1a2de7b98d014b60554f707
4
- data.tar.gz: 25ba7bc504ce1afa3c75ae0b4e1460d66b7aa9c5c5c6765293a984c3b69e6141
3
+ metadata.gz: 519759f371f318856a3e9619a901ba408e839a200ed2f3e7a72a3ce20b715141
4
+ data.tar.gz: d2c728b356148d84f21a6a1ef423ad567d03b0ebe3fbc2ab1c23532165eda543
5
5
  SHA512:
6
- metadata.gz: 0cd68f076f5cfd95b12519a4daa355bb5ba2ea557c9eec0ebe9d005d4c40bb11082cd466a97e446fa35efc6f013d772e853c174e76b39ddb09abb976e8f78219
7
- data.tar.gz: c51d58730dc2a851211076b0bacc81043de84b77d1df0f242fc3ac3d509609771c72f967556f84497d2a45b43ab515347e62d77897faae0025606b31f8845e17
6
+ metadata.gz: 24b28e4dc7559cbaf6726e08dbdd98071a2fcc72e8010142a064398234addcff714fb1b87f7b1bc4b7ab5d528e37ba954c85ada43996f89f6d9eeafe0f618588
7
+ data.tar.gz: 40d488e404bc2fdf4447e758e6ef6e260f8d7bd2a9ac1e2e40efb35cbcf930a11ec672dbf74f0016dcc9819e0209c6309cad94692ab9815b6a141ee28daa8168
@@ -57,14 +57,6 @@ Standard/RailsRenderInline:
57
57
  Standard/RailsRenderObjectCollection:
58
58
  Enabled: false
59
59
 
60
- Standard/RailsViewRenderLiteral:
61
- Enabled: true
62
- StyleGuide: https://Standard.com/Standard/rubocop-Standard/blob/master/guides/rails-render-literal.md
63
- Include:
64
- - "app/helpers/**/*.rb"
65
- - "app/view_models/**/*.rb"
66
- - "app/views/**/*.erb"
67
-
68
60
  Standard/RailsViewRenderPathsExist:
69
61
  Enabled: true
70
62
  ViewPath:
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'rubocop/cop/standard/rails/rails_application_record'
4
4
  require 'rubocop/cop/standard/rails/rails_controller_render_action_symbol'
5
- require 'rubocop/cop/standard/rails/rails_controller_render_literal'
6
5
  require 'rubocop/cop/standard/rails/rails_controller_render_paths_exist'
7
6
  require 'rubocop/cop/standard/rails/rails_controller_render_shorthand'
8
7
  require 'rubocop/cop/standard/rails/rails_render_inline'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-22 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -132,7 +132,6 @@ files:
132
132
  - lib/rubocop/cop/standard/rails/rails_controller_render_shorthand.rb
133
133
  - lib/rubocop/cop/standard/rails/rails_render_inline.rb
134
134
  - lib/rubocop/cop/standard/rails/rails_render_object_collection.rb
135
- - lib/rubocop/cop/standard/rails/rails_view_render_literal.rb
136
135
  - lib/rubocop/cop/standard/rails/rails_view_render_paths_exist.rb
137
136
  - lib/rubocop/cop/standard/rails/rails_view_render_shorthand.rb
138
137
  homepage: https://github.com/gjtorikian/rubocop-standard
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'rubocop'
4
-
5
- module RuboCop
6
- module Cop
7
- module Standard
8
- class RailsViewRenderLiteral < Cop
9
- MSG = 'render must be used with a string literal or an instance of a Class'
10
-
11
- def_node_matcher :literal?, <<-PATTERN
12
- ({str sym true false nil?} ...)
13
- PATTERN
14
-
15
- def_node_matcher :render?, <<-PATTERN
16
- (send nil? :render $...)
17
- PATTERN
18
-
19
- def_node_matcher :render_literal?, <<-PATTERN
20
- (send nil? :render ({str sym} $_) $...)
21
- PATTERN
22
-
23
- def_node_matcher :render_inst?, <<-PATTERN
24
- (send nil? :render (send _ :new ...) ...)
25
- PATTERN
26
-
27
- def_node_matcher :render_const?, <<-PATTERN
28
- (send nil? :render (const _ _) ...)
29
- PATTERN
30
-
31
- def_node_matcher :render_with_options?, <<-PATTERN
32
- (send nil? :render (hash $...) ...)
33
- PATTERN
34
-
35
- def_node_matcher :ignore_key?, <<-PATTERN
36
- (pair (sym {
37
- :inline
38
- }) $_)
39
- PATTERN
40
-
41
- def_node_matcher :partial_key?, <<-PATTERN
42
- (pair (sym {
43
- :file
44
- :template
45
- :layout
46
- :partial
47
- }) $_)
48
- PATTERN
49
-
50
- def on_send(node)
51
- return unless render?(node)
52
-
53
- if render_literal?(node) || render_inst?(node) || render_const?(node)
54
- elsif (option_pairs = render_with_options?(node))
55
- return if option_pairs.any? { |pair| ignore_key?(pair) }
56
-
57
- if (partial_node = option_pairs.map { |pair| partial_key?(pair) }.compact.first)
58
- add_offense(node, location: :expression) unless literal?(partial_node)
59
- else
60
- add_offense(node, location: :expression)
61
- end
62
- else
63
- add_offense(node, location: :expression)
64
- end
65
- end
66
- end
67
- end
68
- end
69
- end