rubocop-github 0.12.0 → 0.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +31 -2
- data/STYLEGUIDE.md +27 -11
- data/config/_default_shared.yml +329 -0
- data/config/_rails_shared.yml +120 -0
- data/config/default.yml +2 -326
- data/config/default_deprecated.yml +4 -0
- data/config/default_edge.yml +4 -0
- data/config/rails.yml +2 -118
- data/config/rails_deprecated.yml +7 -0
- data/config/rails_edge.yml +4 -0
- data/lib/rubocop/cop/github.rb +1 -0
- data/lib/rubocop/cop/github/insecure_hash_algorithm.rb +139 -0
- data/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb +2 -2
- data/lib/rubocop/cop/github/rails_controller_render_literal.rb +31 -16
- data/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb +3 -3
- data/lib/rubocop/cop/github/rails_controller_render_shorthand.rb +1 -1
- data/lib/rubocop/cop/github/rails_render_inline.rb +1 -1
- data/lib/rubocop/cop/github/rails_render_object_collection.rb +1 -1
- data/lib/rubocop/cop/github/rails_view_render_literal.rb +26 -16
- data/lib/rubocop/cop/github/rails_view_render_paths_exist.rb +3 -3
- data/lib/rubocop/cop/github/rails_view_render_shorthand.rb +1 -1
- data/lib/rubocop/cop/github/render_literal_helpers.rb +54 -0
- metadata +49 -14
@@ -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 :render_to_string} $...)
|
11
11
|
PATTERN
|
12
12
|
|
13
13
|
def_node_matcher :render_str?, <<-PATTERN
|
14
|
-
(send nil? :render $(str $_) ...)
|
14
|
+
(send nil? {:render :render_to_string} $(str $_) ...)
|
15
15
|
PATTERN
|
16
16
|
|
17
17
|
def_node_matcher :render_options?, <<-PATTERN
|
18
|
-
(send nil? :render (hash $...))
|
18
|
+
(send nil? {:render :render_to_string} (hash $...))
|
19
19
|
PATTERN
|
20
20
|
|
21
21
|
def_node_matcher :partial_key?, <<-PATTERN
|
@@ -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 :render_to_string} (hash $...))
|
13
13
|
PATTERN
|
14
14
|
|
15
15
|
def_node_matcher :partial_key?, <<-PATTERN
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
require "rubocop"
|
4
|
+
|
5
|
+
module RuboCop
|
6
|
+
module Cop
|
7
|
+
module GitHub
|
8
|
+
module RenderLiteralHelpers
|
9
|
+
extend NodePattern::Macros
|
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 :render_to_string} ...)
|
17
|
+
PATTERN
|
18
|
+
|
19
|
+
def_node_matcher :render_literal?, <<-PATTERN
|
20
|
+
(send nil? {:render :render_to_string} ({str sym} $_) $...)
|
21
|
+
PATTERN
|
22
|
+
|
23
|
+
def_node_matcher :render_inst?, <<-PATTERN
|
24
|
+
(send nil? {:render :render_to_string} (send _ :new ...) ...)
|
25
|
+
PATTERN
|
26
|
+
|
27
|
+
def_node_matcher :render_with_options?, <<-PATTERN
|
28
|
+
(send nil? {:render :render_to_string} (hash $...) ...)
|
29
|
+
PATTERN
|
30
|
+
|
31
|
+
def_node_matcher :render_view_component_instance?, <<-PATTERN
|
32
|
+
(send nil? {:render :render_to_string} (send _ :new ...) ...)
|
33
|
+
PATTERN
|
34
|
+
|
35
|
+
def_node_matcher :render_view_component_collection?, <<-PATTERN
|
36
|
+
(send nil? {:render :render_to_string} (send _ :with_collection ...) ...)
|
37
|
+
PATTERN
|
38
|
+
|
39
|
+
def_node_matcher :locals_key?, <<-PATTERN
|
40
|
+
(pair (sym :locals) $_)
|
41
|
+
PATTERN
|
42
|
+
|
43
|
+
def hash_with_literal_keys?(hash)
|
44
|
+
hash.pairs.all? { |pair| literal?(pair.key) }
|
45
|
+
end
|
46
|
+
|
47
|
+
def render_view_component?(node)
|
48
|
+
render_view_component_instance?(node) ||
|
49
|
+
render_view_component_collection?(node)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.6.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop-performance
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.7.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "<="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.7.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "<="
|
25
53
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
54
|
+
version: 2.7.1
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: actionview
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +72,14 @@ dependencies:
|
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
75
|
+
version: '5.14'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
82
|
+
version: '5.14'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: rake
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,12 +103,19 @@ files:
|
|
75
103
|
- LICENSE
|
76
104
|
- README.md
|
77
105
|
- STYLEGUIDE.md
|
106
|
+
- config/_default_shared.yml
|
107
|
+
- config/_rails_shared.yml
|
78
108
|
- config/default.yml
|
109
|
+
- config/default_deprecated.yml
|
110
|
+
- config/default_edge.yml
|
79
111
|
- config/rails.yml
|
112
|
+
- config/rails_deprecated.yml
|
113
|
+
- config/rails_edge.yml
|
80
114
|
- guides/rails-controller-render-shorthand.md
|
81
115
|
- guides/rails-render-inline.md
|
82
116
|
- guides/rails-render-literal.md
|
83
117
|
- lib/rubocop/cop/github.rb
|
118
|
+
- lib/rubocop/cop/github/insecure_hash_algorithm.rb
|
84
119
|
- lib/rubocop/cop/github/rails_application_record.rb
|
85
120
|
- lib/rubocop/cop/github/rails_controller_render_action_symbol.rb
|
86
121
|
- lib/rubocop/cop/github/rails_controller_render_literal.rb
|
@@ -91,11 +126,12 @@ files:
|
|
91
126
|
- lib/rubocop/cop/github/rails_view_render_literal.rb
|
92
127
|
- lib/rubocop/cop/github/rails_view_render_paths_exist.rb
|
93
128
|
- lib/rubocop/cop/github/rails_view_render_shorthand.rb
|
129
|
+
- lib/rubocop/cop/github/render_literal_helpers.rb
|
94
130
|
homepage: https://github.com/github/rubocop-github
|
95
131
|
licenses:
|
96
132
|
- MIT
|
97
133
|
metadata: {}
|
98
|
-
post_install_message:
|
134
|
+
post_install_message:
|
99
135
|
rdoc_options: []
|
100
136
|
require_paths:
|
101
137
|
- lib
|
@@ -103,16 +139,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
139
|
requirements:
|
104
140
|
- - ">="
|
105
141
|
- !ruby/object:Gem::Version
|
106
|
-
version: 2.
|
142
|
+
version: 2.5.0
|
107
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
144
|
requirements:
|
109
145
|
- - ">="
|
110
146
|
- !ruby/object:Gem::Version
|
111
147
|
version: '0'
|
112
148
|
requirements: []
|
113
|
-
|
114
|
-
|
115
|
-
signing_key:
|
149
|
+
rubygems_version: 3.1.4
|
150
|
+
signing_key:
|
116
151
|
specification_version: 4
|
117
152
|
summary: RuboCop GitHub
|
118
153
|
test_files: []
|