rubocop-github 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/rails.yml +9 -6
- data/lib/rubocop/cop/github.rb +1 -1
- data/lib/rubocop/cop/github/rails_controller_render_literal.rb +1 -0
- data/lib/rubocop/cop/github/{rails_controller_render_inline.rb → rails_render_inline.rb} +1 -1
- data/lib/rubocop/cop/github/rails_view_render_literal.rb +11 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 207be109d4ce7854620ccad83592f04fe8cdb06e
|
4
|
+
data.tar.gz: a11cca89a562cc3c7c7518a094f7f3063d400d20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f75e2f6854f25ab19a62e5e371e2d068df4ea91f0c7deb6631ea7e4f4d416f7258017f2e4cb0b06aaf00cc7e4b9c424e19ffcf16d45d7106c82505e9d1b3d63
|
7
|
+
data.tar.gz: c4efb68eb56ae3f49f6656437d1bb81c72b4a22b069f96a22af90077b9e8ac6d30b591eff9337609dd0c0cf6059e89a259282def47c9a0a68c2866737d16fd2a
|
data/config/rails.yml
CHANGED
@@ -28,12 +28,6 @@ GitHub/RailsControllerRenderActionSymbol:
|
|
28
28
|
Include:
|
29
29
|
- 'app/controllers/**/*.rb'
|
30
30
|
|
31
|
-
GitHub/RailsControllerRenderInline:
|
32
|
-
Enabled: true
|
33
|
-
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md
|
34
|
-
Include:
|
35
|
-
- 'app/controllers/**/*.rb'
|
36
|
-
|
37
31
|
GitHub/RailsControllerRenderLiteral:
|
38
32
|
Enabled: true
|
39
33
|
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-render-literal.md
|
@@ -53,6 +47,15 @@ GitHub/RailsControllerRenderShorthand:
|
|
53
47
|
Include:
|
54
48
|
- 'app/controllers/**/*.rb'
|
55
49
|
|
50
|
+
GitHub/RailsRenderInline:
|
51
|
+
Enabled: true
|
52
|
+
StyleGuide: https://github.com/github/rubocop-github/blob/master/guides/rails-controller-render-inline.md
|
53
|
+
Include:
|
54
|
+
- 'app/controllers/**/*.rb'
|
55
|
+
- 'app/helpers/**/*.rb'
|
56
|
+
- 'app/view_models/**/*.rb'
|
57
|
+
- 'app/views/**/*.erb'
|
58
|
+
|
56
59
|
GitHub/RailsRenderObjectCollection:
|
57
60
|
Enabled: false
|
58
61
|
|
data/lib/rubocop/cop/github.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "rubocop/cop/github/rails_application_record"
|
2
2
|
require "rubocop/cop/github/rails_controller_render_action_symbol"
|
3
|
-
require "rubocop/cop/github/rails_controller_render_inline"
|
4
3
|
require "rubocop/cop/github/rails_controller_render_literal"
|
5
4
|
require "rubocop/cop/github/rails_controller_render_paths_exist"
|
6
5
|
require "rubocop/cop/github/rails_controller_render_shorthand"
|
6
|
+
require "rubocop/cop/github/rails_render_inline"
|
7
7
|
require "rubocop/cop/github/rails_render_object_collection"
|
8
8
|
require "rubocop/cop/github/rails_view_render_literal"
|
9
9
|
require "rubocop/cop/github/rails_view_render_paths_exist"
|
@@ -21,7 +21,13 @@ module RuboCop
|
|
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
|
+
PATTERN
|
26
|
+
|
27
|
+
def_node_matcher :ignore_key?, <<-PATTERN
|
28
|
+
(pair (sym {
|
29
|
+
:inline
|
30
|
+
}) $_)
|
25
31
|
PATTERN
|
26
32
|
|
27
33
|
def_node_matcher :partial_key?, <<-PATTERN
|
@@ -37,6 +43,10 @@ module RuboCop
|
|
37
43
|
|
38
44
|
if render_literal?(node)
|
39
45
|
elsif option_pairs = render_with_options?(node)
|
46
|
+
if option_pairs.any? { |pair| ignore_key?(pair) }
|
47
|
+
return
|
48
|
+
end
|
49
|
+
|
40
50
|
if partial_node = option_pairs.map { |pair| partial_key?(pair) }.compact.first
|
41
51
|
if !literal?(partial_node)
|
42
52
|
add_offense(node, :expression)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
@@ -80,10 +80,10 @@ files:
|
|
80
80
|
- lib/rubocop/cop/github.rb
|
81
81
|
- lib/rubocop/cop/github/rails_application_record.rb
|
82
82
|
- lib/rubocop/cop/github/rails_controller_render_action_symbol.rb
|
83
|
-
- lib/rubocop/cop/github/rails_controller_render_inline.rb
|
84
83
|
- lib/rubocop/cop/github/rails_controller_render_literal.rb
|
85
84
|
- lib/rubocop/cop/github/rails_controller_render_paths_exist.rb
|
86
85
|
- lib/rubocop/cop/github/rails_controller_render_shorthand.rb
|
86
|
+
- lib/rubocop/cop/github/rails_render_inline.rb
|
87
87
|
- lib/rubocop/cop/github/rails_render_object_collection.rb
|
88
88
|
- lib/rubocop/cop/github/rails_view_render_literal.rb
|
89
89
|
- lib/rubocop/cop/github/rails_view_render_paths_exist.rb
|