rubocop-standard 4.0.0 → 4.0.1
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: 154bd735712aeb599483846660cbbd986b671dd688cc3333230a9eff57e8126d
|
4
|
+
data.tar.gz: c16151de7fca5c05678fc3b7ea9f48d12b3e9fc4408bae31dae10678d940bf97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f3489a4d5c60a14d9615729fc3d21fc49892ec76f07961b529da5bd6fe1fe824b4e1ed3b8ca930d3b870438c1b6a03152815854cb20a538279a8e89dc99934d
|
7
|
+
data.tar.gz: 6c1bef701af0fa3eb49d5a50dd076ff800f6cce39c7592b4fd61cf9eb76277172889ad9b4d23c83f3883ba9b1840378c3d8af8a2cf9d0e48864fa2a604bca59c
|
data/config/rails.yml
CHANGED
@@ -26,12 +26,6 @@ Standard/RailsControllerRenderActionSymbol:
|
|
26
26
|
Include:
|
27
27
|
- "app/controllers/**/*.rb"
|
28
28
|
|
29
|
-
Standard/RailsControllerRenderLiteral:
|
30
|
-
Enabled: true
|
31
|
-
StyleGuide: https://Standard.com/Standard/rubocop-Standard/blob/master/guides/rails-render-literal.md
|
32
|
-
Include:
|
33
|
-
- "app/controllers/**/*.rb"
|
34
|
-
|
35
29
|
Standard/RailsControllerRenderPathsExist:
|
36
30
|
Enabled: true
|
37
31
|
ViewPath:
|
@@ -6,6 +6,5 @@ require 'rubocop/cop/standard/rails/rails_controller_render_paths_exist'
|
|
6
6
|
require 'rubocop/cop/standard/rails/rails_controller_render_shorthand'
|
7
7
|
require 'rubocop/cop/standard/rails/rails_render_inline'
|
8
8
|
require 'rubocop/cop/standard/rails/rails_render_object_collection'
|
9
|
-
require 'rubocop/cop/standard/rails/rails_view_render_literal'
|
10
9
|
require 'rubocop/cop/standard/rails/rails_view_render_paths_exist'
|
11
10
|
require 'rubocop/cop/standard/rails/rails_view_render_shorthand'
|
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: 4.0.
|
4
|
+
version: 4.0.1
|
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-03-
|
11
|
+
date: 2020-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -127,7 +127,6 @@ files:
|
|
127
127
|
- lib/rubocop/cop/standard/rails.rb
|
128
128
|
- lib/rubocop/cop/standard/rails/rails_application_record.rb
|
129
129
|
- lib/rubocop/cop/standard/rails/rails_controller_render_action_symbol.rb
|
130
|
-
- lib/rubocop/cop/standard/rails/rails_controller_render_literal.rb
|
131
130
|
- lib/rubocop/cop/standard/rails/rails_controller_render_paths_exist.rb
|
132
131
|
- lib/rubocop/cop/standard/rails/rails_controller_render_shorthand.rb
|
133
132
|
- lib/rubocop/cop/standard/rails/rails_render_inline.rb
|
@@ -1,96 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'rubocop'
|
4
|
-
|
5
|
-
module RuboCop
|
6
|
-
module Cop
|
7
|
-
module Standard
|
8
|
-
class RailsControllerRenderLiteral < 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_const?, <<-PATTERN
|
24
|
-
(send nil? :render (const _ _) ...)
|
25
|
-
PATTERN
|
26
|
-
|
27
|
-
def_node_matcher :render_inst?, <<-PATTERN
|
28
|
-
(send nil? :render (send _ :new ...) ...)
|
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
|
-
:body
|
38
|
-
:file
|
39
|
-
:html
|
40
|
-
:inline
|
41
|
-
:js
|
42
|
-
:json
|
43
|
-
:nothing
|
44
|
-
:plain
|
45
|
-
:text
|
46
|
-
:xml
|
47
|
-
}) $_)
|
48
|
-
PATTERN
|
49
|
-
|
50
|
-
def_node_matcher :template_key?, <<-PATTERN
|
51
|
-
(pair (sym {
|
52
|
-
:action
|
53
|
-
:partial
|
54
|
-
:template
|
55
|
-
}) $_)
|
56
|
-
PATTERN
|
57
|
-
|
58
|
-
def_node_matcher :layout_key?, <<-PATTERN
|
59
|
-
(pair (sym :layout) $_)
|
60
|
-
PATTERN
|
61
|
-
|
62
|
-
def_node_matcher :options_key?, <<-PATTERN
|
63
|
-
(pair (sym {
|
64
|
-
:content_type
|
65
|
-
:location
|
66
|
-
:status
|
67
|
-
:formats
|
68
|
-
}) ...)
|
69
|
-
PATTERN
|
70
|
-
|
71
|
-
def on_send(node)
|
72
|
-
return unless render?(node)
|
73
|
-
|
74
|
-
if render_literal?(node) || render_inst?(node) || render_const?(node)
|
75
|
-
elsif (option_pairs = render_with_options?(node))
|
76
|
-
option_pairs = option_pairs.reject { |pair| options_key?(pair) }
|
77
|
-
|
78
|
-
return if option_pairs.any? { |pair| ignore_key?(pair) }
|
79
|
-
|
80
|
-
if (template_node = option_pairs.map { |pair| template_key?(pair) }.compact.first)
|
81
|
-
add_offense(node, location: :expression) unless literal?(template_node)
|
82
|
-
else
|
83
|
-
add_offense(node, location: :expression)
|
84
|
-
end
|
85
|
-
|
86
|
-
if (layout_node = option_pairs.map { |pair| layout_key?(pair) }.compact.first)
|
87
|
-
add_offense(node, location: :expression) unless literal?(layout_node)
|
88
|
-
end
|
89
|
-
else
|
90
|
-
add_offense(node, location: :expression)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|