rubocop-github 0.18.0 → 0.20.0

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.
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.18.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-27 00:00:00.000000000 Z
11
+ date: 2022-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,42 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: '1.37'
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: 1.0.0
26
+ version: '1.37'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-performance
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.15'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.15'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.17'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.17'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: actionview
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -104,23 +104,28 @@ files:
104
104
  - README.md
105
105
  - STYLEGUIDE.md
106
106
  - config/default.yml
107
+ - config/default_cops.yml
108
+ - config/default_pending.yml
107
109
  - config/rails.yml
110
+ - config/rails_cops.yml
111
+ - config/rails_pending.yml
108
112
  - guides/rails-controller-render-shorthand.md
109
- - guides/rails-render-inline.md
110
113
  - guides/rails-render-literal.md
114
+ - lib/rubocop-github-rails.rb
115
+ - lib/rubocop-github.rb
111
116
  - lib/rubocop/cop/github.rb
112
117
  - lib/rubocop/cop/github/insecure_hash_algorithm.rb
113
- - lib/rubocop/cop/github/rails_application_record.rb
114
118
  - lib/rubocop/cop/github/rails_controller_render_action_symbol.rb
115
119
  - lib/rubocop/cop/github/rails_controller_render_literal.rb
116
120
  - lib/rubocop/cop/github/rails_controller_render_paths_exist.rb
117
121
  - lib/rubocop/cop/github/rails_controller_render_shorthand.rb
118
- - lib/rubocop/cop/github/rails_render_inline.rb
119
122
  - lib/rubocop/cop/github/rails_render_object_collection.rb
120
123
  - lib/rubocop/cop/github/rails_view_render_literal.rb
121
124
  - lib/rubocop/cop/github/rails_view_render_paths_exist.rb
122
125
  - lib/rubocop/cop/github/rails_view_render_shorthand.rb
123
126
  - lib/rubocop/cop/github/render_literal_helpers.rb
127
+ - lib/rubocop/github.rb
128
+ - lib/rubocop/github/inject.rb
124
129
  homepage: https://github.com/github/rubocop-github
125
130
  licenses:
126
131
  - MIT
@@ -140,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
145
  - !ruby/object:Gem::Version
141
146
  version: '0'
142
147
  requirements: []
143
- rubygems_version: 3.2.22
148
+ rubygems_version: 3.3.7
144
149
  signing_key:
145
150
  specification_version: 4
146
151
  summary: RuboCop GitHub
@@ -1,27 +0,0 @@
1
- # GitHub/RailsRenderInline
2
-
3
- tldr; Do not use `render inline:`.
4
-
5
- ## Rendering plain text
6
-
7
- ``` ruby
8
- render inline: "Just plain text" # bad
9
- ```
10
-
11
- The `inline:` option is often misused when plain text is being returned. Instead use `render plain: "Just plain text"`.
12
-
13
- ## Rendering a dynamic ERB string
14
-
15
- String `#{}` interpolation is often misused with `render inline:` instead of using `<%= %>` interpolation. This will lead to a memory leak where an ERB method will be compiled and cached for each invocation of `render inline:`.
16
-
17
- ``` ruby
18
- render inline: "Hello #{@name}" # bad
19
- ```
20
-
21
- ## Rendering static ERB strings
22
-
23
- ``` ruby
24
- render inline: "Hello <%= @name %>" # bad
25
- ```
26
-
27
- If you are passing a static ERB string to `render inline:`, this string is best moved to a `.erb` template under `app/views`. Template files are able to be precompiled at boot time.
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
-
5
- module RuboCop
6
- module Cop
7
- module GitHub
8
- class RailsApplicationRecord < Base
9
- MSG = "Models should subclass from ApplicationRecord"
10
-
11
- def_node_matcher :active_record_base_const?, <<-PATTERN
12
- (const (const nil? :ActiveRecord) :Base)
13
- PATTERN
14
-
15
- def_node_matcher :application_record_const?, <<-PATTERN
16
- (const nil? :ApplicationRecord)
17
- PATTERN
18
-
19
- def on_class(node)
20
- klass, superclass, _ = *node
21
-
22
- if active_record_base_const?(superclass) && !(application_record_const?(klass))
23
- add_offense(superclass)
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
-
5
- module RuboCop
6
- module Cop
7
- module GitHub
8
- class RailsRenderInline < Base
9
- MSG = "Avoid `render inline:`"
10
-
11
- def_node_matcher :render_with_options?, <<-PATTERN
12
- (send nil? {:render :render_to_string} (hash $...))
13
- PATTERN
14
-
15
- def_node_matcher :inline_key?, <<-PATTERN
16
- (pair (sym :inline) $_)
17
- PATTERN
18
-
19
- def on_send(node)
20
- if option_pairs = render_with_options?(node)
21
- if option_pairs.detect { |pair| inline_key?(pair) }
22
- add_offense(node)
23
- end
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end