rubocop-yiffspace 0.0.1 → 0.0.2
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 +4 -4
- data/.idea/rubocop-plugin.iml +1 -1
- data/config/custom.yml +1 -1
- data/config/default.yml +3 -3
- data/lib/rubocop/cop/yiff_space/{current_user_outside_of_requests.rb → current_outside_of_requests.rb} +27 -27
- data/lib/rubocop/cop/yiffspace_cops.rb +1 -1
- data/lib/rubocop/yiff_space/version.rb +1 -1
- data/spec/rubocop/cop/yiff_space/{current_user_outside_of_requests_spec.rb → current_outside_of_requests_spec.rb} +43 -43
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d1aa5c8d299b99107f249c032619f8b171b694da54cfabd87648c5b3ef63306d
|
|
4
|
+
data.tar.gz: 2164dc6656be713ec9edf33e113e8d3334220d4a2392ac38d8e6666d0031a575
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 235d3cb1a815f93eec728df0a8826902dc955d6fa21f4a83ea9eef705528fe85b6dac93dfb785a8c052ce68a2d7002ebb5c4b6b3cd6946d3d4ed1cb482b5686a
|
|
7
|
+
data.tar.gz: e5596b27896ce8d6360a33a53a171d24deaa90aafc410529cb631403130b6dfe8a8d19a2927fd2e725b2a11b88727f85754400c58d85b924e7a8d545cf2ee8e4
|
data/.idea/rubocop-plugin.iml
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, rbenv: 3.4.1) [gem]" level="application" />
|
|
16
16
|
<orderEntry type="library" scope="PROVIDED" name="base64 (v0.3.0, rbenv: 3.4.1) [gem]" level="application" />
|
|
17
17
|
<orderEntry type="library" scope="PROVIDED" name="bigdecimal (v4.1.2, rbenv: 3.4.1) [gem]" level="application" />
|
|
18
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v4.0.
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v4.0.11, rbenv: 3.4.1) [gem]" level="application" />
|
|
19
19
|
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.6, rbenv: 3.4.1) [gem]" level="application" />
|
|
20
20
|
<orderEntry type="library" scope="PROVIDED" name="connection_pool (v3.0.2, rbenv: 3.4.1) [gem]" level="application" />
|
|
21
21
|
<orderEntry type="library" scope="PROVIDED" name="date (v3.5.1, rbenv: 3.4.1) [gem]" level="application" />
|
data/config/custom.yml
CHANGED
data/config/default.yml
CHANGED
|
@@ -19,11 +19,11 @@ YiffSpace/BelongsToUserMissingIp:
|
|
|
19
19
|
VersionAdded: '<<next>>'
|
|
20
20
|
SafeAutoCorrect: false
|
|
21
21
|
|
|
22
|
-
YiffSpace/
|
|
23
|
-
Description: 'Restricts use of `
|
|
22
|
+
YiffSpace/CurrentOutsideOfRequests:
|
|
23
|
+
Description: 'Restricts use of `Current` to the request cycle (controllers, views, helpers, decorators).'
|
|
24
24
|
Enabled: false
|
|
25
25
|
VersionAdded: '<<next>>'
|
|
26
|
-
ClassName:
|
|
26
|
+
ClassName: Current
|
|
27
27
|
Exclude:
|
|
28
28
|
- app/views/**/*.erb
|
|
29
29
|
- app/controllers/**/*.rb
|
|
@@ -3,58 +3,58 @@
|
|
|
3
3
|
module RuboCop
|
|
4
4
|
module Cop
|
|
5
5
|
module YiffSpace
|
|
6
|
-
# Prevents use of the
|
|
7
|
-
# cycle.
|
|
6
|
+
# Prevents use of the Current class outside of the request
|
|
7
|
+
# cycle. Current relies on thread-local state set by request
|
|
8
8
|
# middleware and is unavailable in background jobs, rake tasks, or other
|
|
9
9
|
# contexts outside of the request lifecycle.
|
|
10
10
|
#
|
|
11
|
-
# The class name is configurable via `ClassName` (default: `
|
|
12
|
-
# References inside the class that defines
|
|
11
|
+
# The class name is configurable via `ClassName` (default: `Current`).
|
|
12
|
+
# References inside the class that defines Current itself are always
|
|
13
13
|
# ignored. Controllers, views, helpers, presenters, and decorators are
|
|
14
14
|
# excluded by default. Use `IgnoredMethods`, `IgnoredMethodPrefixes`,
|
|
15
15
|
# `IgnoredMethodSuffixes`, or `IgnoredMethodPatterns` to allow
|
|
16
|
-
#
|
|
16
|
+
# Current in specific methods in checked files.
|
|
17
17
|
#
|
|
18
18
|
# @example
|
|
19
19
|
# # bad
|
|
20
20
|
# def process_records
|
|
21
|
-
#
|
|
21
|
+
# Current.id
|
|
22
22
|
# end
|
|
23
23
|
#
|
|
24
24
|
# # bad
|
|
25
25
|
# def notify
|
|
26
|
-
#
|
|
26
|
+
# Current.email
|
|
27
27
|
# end
|
|
28
28
|
#
|
|
29
|
-
# # good - inside the
|
|
30
|
-
# class
|
|
29
|
+
# # good - inside the Current class definition itself
|
|
30
|
+
# class Current
|
|
31
31
|
# def self.id
|
|
32
|
-
# RequestStore[:
|
|
32
|
+
# RequestStore[:current]&.id
|
|
33
33
|
# end
|
|
34
34
|
# end
|
|
35
35
|
#
|
|
36
36
|
# # good (IgnoredMethodSuffixes: [_current])
|
|
37
37
|
# def user_current
|
|
38
|
-
#
|
|
38
|
+
# Current.id
|
|
39
39
|
# end
|
|
40
40
|
#
|
|
41
41
|
# # good (IgnoredMethodPrefixes: [apionly_])
|
|
42
42
|
# def apionly_serialize
|
|
43
|
-
#
|
|
43
|
+
# Current.email
|
|
44
44
|
# end
|
|
45
45
|
#
|
|
46
46
|
# # good (IgnoredMethodPatterns: [/_current_user_/])
|
|
47
47
|
# def serialize_current_user_email
|
|
48
|
-
#
|
|
48
|
+
# Current.email
|
|
49
49
|
# end
|
|
50
50
|
#
|
|
51
|
-
class
|
|
51
|
+
class CurrentOutsideOfRequests < Base
|
|
52
52
|
MSG = "`%<class_name>s` should only be used within the request cycle (controllers, views, helpers, decorators)"
|
|
53
53
|
|
|
54
54
|
def on_send(node)
|
|
55
|
-
return unless
|
|
55
|
+
return unless starts_with_current?(node)
|
|
56
56
|
return if ignored_method?(node)
|
|
57
|
-
return if
|
|
57
|
+
return if inside_current_class?(node)
|
|
58
58
|
|
|
59
59
|
add_offense(node, message: message)
|
|
60
60
|
end
|
|
@@ -64,9 +64,9 @@ module RuboCop
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
def on_const(node)
|
|
67
|
-
return unless
|
|
67
|
+
return unless current?(node)
|
|
68
68
|
return if ignored_method?(node)
|
|
69
|
-
return if
|
|
69
|
+
return if inside_current_class?(node)
|
|
70
70
|
return if node.parent&.send_type? && node.parent.receiver == node
|
|
71
71
|
|
|
72
72
|
add_offense(node, message: message)
|
|
@@ -75,17 +75,17 @@ module RuboCop
|
|
|
75
75
|
private
|
|
76
76
|
|
|
77
77
|
def message
|
|
78
|
-
format(MSG, class_name:
|
|
78
|
+
format(MSG, class_name: current_class_name)
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
def
|
|
82
|
-
cop_config.fetch("ClassName", "
|
|
81
|
+
def current_class_name
|
|
82
|
+
cop_config.fetch("ClassName", "Current")
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
def
|
|
85
|
+
def current?(node)
|
|
86
86
|
return false unless node.const_type?
|
|
87
87
|
|
|
88
|
-
class_parts =
|
|
88
|
+
class_parts = current_class_name.split("::")
|
|
89
89
|
is_absolute, ref_parts = extract_const_info(node)
|
|
90
90
|
|
|
91
91
|
return ref_parts == class_parts if is_absolute
|
|
@@ -112,13 +112,13 @@ module RuboCop
|
|
|
112
112
|
inner_ancestors.none? { |anc| defines_const_in_body?(anc, ref_parts[0]) }
|
|
113
113
|
end
|
|
114
114
|
|
|
115
|
-
def
|
|
116
|
-
node.receiver &&
|
|
115
|
+
def starts_with_current?(node)
|
|
116
|
+
node.receiver && current?(node.receiver)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
def
|
|
119
|
+
def inside_current_class?(node)
|
|
120
120
|
node.each_ancestor(:class).any? do |class_node|
|
|
121
|
-
resolved_class_name(class_node) ==
|
|
121
|
+
resolved_class_name(class_node) == current_class_name
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
124
|
|
|
@@ -5,6 +5,6 @@ require_relative("mixin/active_record_helper")
|
|
|
5
5
|
require_relative("yiff_space/belongs_to_user")
|
|
6
6
|
require_relative("yiff_space/belongs_to_user_invalid_ip")
|
|
7
7
|
require_relative("yiff_space/belongs_to_user_missing_ip")
|
|
8
|
-
require_relative("yiff_space/
|
|
8
|
+
require_relative("yiff_space/current_outside_of_requests")
|
|
9
9
|
require_relative("yiff_space/resolvable_user")
|
|
10
10
|
require_relative("yiff_space/user_to_id")
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
RSpec.describe(RuboCop::Cop::YiffSpace::
|
|
3
|
+
RSpec.describe(RuboCop::Cop::YiffSpace::CurrentOutsideOfRequests, :config) do
|
|
4
4
|
let(:config) do
|
|
5
5
|
RuboCop::Config.new(
|
|
6
|
-
"YiffSpace/
|
|
7
|
-
"ClassName" => "
|
|
6
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
7
|
+
"ClassName" => "Current",
|
|
8
8
|
"IgnoredMethods" => [],
|
|
9
9
|
"IgnoredMethodPrefixes" => [],
|
|
10
10
|
"IgnoredMethodSuffixes" => [],
|
|
@@ -13,27 +13,27 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
13
13
|
)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
it("registers an offense for
|
|
16
|
+
it("registers an offense for Current.method calls in a regular method") do
|
|
17
17
|
expect_offense(<<~RUBY)
|
|
18
18
|
def process
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Current.id
|
|
20
|
+
^^^^^^^^^^ `Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
21
21
|
end
|
|
22
22
|
RUBY
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
it("registers an offense for a bare
|
|
25
|
+
it("registers an offense for a bare Current constant reference") do
|
|
26
26
|
expect_offense(<<~RUBY)
|
|
27
27
|
def process
|
|
28
|
-
user =
|
|
29
|
-
|
|
28
|
+
user = Current
|
|
29
|
+
^^^^^^^ `Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
30
30
|
end
|
|
31
31
|
RUBY
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
it("does not register an offense when
|
|
34
|
+
it("does not register an offense when Current is used inside its own class definition") do
|
|
35
35
|
expect_no_offenses(<<~RUBY)
|
|
36
|
-
class
|
|
36
|
+
class Current
|
|
37
37
|
def self.id
|
|
38
38
|
RequestStore[:current_user]&.id
|
|
39
39
|
end
|
|
@@ -43,7 +43,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
43
43
|
|
|
44
44
|
it("does not register an offense inside a qualified class definition matching ClassName") do
|
|
45
45
|
expect_no_offenses(<<~RUBY)
|
|
46
|
-
class Logical::
|
|
46
|
+
class Logical::Current
|
|
47
47
|
def self.email
|
|
48
48
|
RequestStore[:current_user]&.email
|
|
49
49
|
end
|
|
@@ -54,8 +54,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
54
54
|
context("when ClassName is a fully-qualified nested constant") do
|
|
55
55
|
let(:config) do
|
|
56
56
|
RuboCop::Config.new(
|
|
57
|
-
"YiffSpace/
|
|
58
|
-
"ClassName" => "Logical::
|
|
57
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
58
|
+
"ClassName" => "Logical::Current",
|
|
59
59
|
"IgnoredMethods" => [],
|
|
60
60
|
"IgnoredMethodPrefixes" => [],
|
|
61
61
|
"IgnoredMethodSuffixes" => [],
|
|
@@ -67,7 +67,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
67
67
|
it("does not register an offense inside the matching nested class definition") do
|
|
68
68
|
expect_no_offenses(<<~RUBY)
|
|
69
69
|
module Logical
|
|
70
|
-
class
|
|
70
|
+
class Current
|
|
71
71
|
def self.email
|
|
72
72
|
RequestStore[:current_user]&.email
|
|
73
73
|
end
|
|
@@ -76,20 +76,20 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
76
76
|
RUBY
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
it("does not register an offense for a bare
|
|
79
|
+
it("does not register an offense for a bare Current reference outside the Logical namespace") do
|
|
80
80
|
expect_no_offenses(<<~RUBY)
|
|
81
81
|
def process
|
|
82
|
-
|
|
82
|
+
Current.id
|
|
83
83
|
end
|
|
84
84
|
RUBY
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
it("registers an offense for
|
|
87
|
+
it("registers an offense for Current inside the Logical namespace") do
|
|
88
88
|
expect_offense(<<~RUBY)
|
|
89
89
|
module Logical
|
|
90
90
|
def self.process
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
Current.id
|
|
92
|
+
^^^^^^^^^^ `Logical::Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
93
93
|
end
|
|
94
94
|
end
|
|
95
95
|
RUBY
|
|
@@ -100,8 +100,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
100
100
|
expect_offense(<<~RUBY)
|
|
101
101
|
class PostService
|
|
102
102
|
def call
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
Current.id
|
|
104
|
+
^^^^^^^^^^ `Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
RUBY
|
|
@@ -110,8 +110,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
110
110
|
context("with IgnoredMethods") do
|
|
111
111
|
let(:config) do
|
|
112
112
|
RuboCop::Config.new(
|
|
113
|
-
"YiffSpace/
|
|
114
|
-
"ClassName" => "
|
|
113
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
114
|
+
"ClassName" => "Current",
|
|
115
115
|
"IgnoredMethods" => ["serializable_hash"],
|
|
116
116
|
"IgnoredMethodPrefixes" => [],
|
|
117
117
|
"IgnoredMethodSuffixes" => [],
|
|
@@ -123,7 +123,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
123
123
|
it("does not register an offense in an ignored method") do
|
|
124
124
|
expect_no_offenses(<<~RUBY)
|
|
125
125
|
def serializable_hash
|
|
126
|
-
|
|
126
|
+
Current.id
|
|
127
127
|
end
|
|
128
128
|
RUBY
|
|
129
129
|
end
|
|
@@ -131,8 +131,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
131
131
|
it("still registers an offense in a non-ignored method") do
|
|
132
132
|
expect_offense(<<~RUBY)
|
|
133
133
|
def process
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
Current.id
|
|
135
|
+
^^^^^^^^^^ `Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
136
136
|
end
|
|
137
137
|
RUBY
|
|
138
138
|
end
|
|
@@ -141,8 +141,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
141
141
|
context("with IgnoredMethodPrefixes") do
|
|
142
142
|
let(:config) do
|
|
143
143
|
RuboCop::Config.new(
|
|
144
|
-
"YiffSpace/
|
|
145
|
-
"ClassName" => "
|
|
144
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
145
|
+
"ClassName" => "Current",
|
|
146
146
|
"IgnoredMethods" => [],
|
|
147
147
|
"IgnoredMethodPrefixes" => ["apionly_"],
|
|
148
148
|
"IgnoredMethodSuffixes" => [],
|
|
@@ -154,7 +154,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
154
154
|
it("does not register an offense in a method matching the prefix") do
|
|
155
155
|
expect_no_offenses(<<~RUBY)
|
|
156
156
|
def apionly_serialize
|
|
157
|
-
|
|
157
|
+
Current.id
|
|
158
158
|
end
|
|
159
159
|
RUBY
|
|
160
160
|
end
|
|
@@ -162,8 +162,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
162
162
|
it("still registers an offense in a method not matching the prefix") do
|
|
163
163
|
expect_offense(<<~RUBY)
|
|
164
164
|
def process
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
Current.id
|
|
166
|
+
^^^^^^^^^^ `Current` should only be used within the request cycle (controllers, views, helpers, decorators)
|
|
167
167
|
end
|
|
168
168
|
RUBY
|
|
169
169
|
end
|
|
@@ -172,8 +172,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
172
172
|
context("with IgnoredMethodSuffixes") do
|
|
173
173
|
let(:config) do
|
|
174
174
|
RuboCop::Config.new(
|
|
175
|
-
"YiffSpace/
|
|
176
|
-
"ClassName" => "
|
|
175
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
176
|
+
"ClassName" => "Current",
|
|
177
177
|
"IgnoredMethods" => [],
|
|
178
178
|
"IgnoredMethodPrefixes" => [],
|
|
179
179
|
"IgnoredMethodSuffixes" => ["_current"],
|
|
@@ -185,7 +185,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
185
185
|
it("does not register an offense in a method matching the suffix") do
|
|
186
186
|
expect_no_offenses(<<~RUBY)
|
|
187
187
|
def user_current
|
|
188
|
-
|
|
188
|
+
Current.id
|
|
189
189
|
end
|
|
190
190
|
RUBY
|
|
191
191
|
end
|
|
@@ -194,8 +194,8 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
194
194
|
context("with IgnoredMethodPatterns") do
|
|
195
195
|
let(:config) do
|
|
196
196
|
RuboCop::Config.new(
|
|
197
|
-
"YiffSpace/
|
|
198
|
-
"ClassName" => "
|
|
197
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
198
|
+
"ClassName" => "Current",
|
|
199
199
|
"IgnoredMethods" => [],
|
|
200
200
|
"IgnoredMethodPrefixes" => [],
|
|
201
201
|
"IgnoredMethodSuffixes" => [],
|
|
@@ -207,7 +207,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
207
207
|
it("does not register an offense in a method matching the pattern") do
|
|
208
208
|
expect_no_offenses(<<~RUBY)
|
|
209
209
|
def with_current_user_context
|
|
210
|
-
|
|
210
|
+
Current.id
|
|
211
211
|
end
|
|
212
212
|
RUBY
|
|
213
213
|
end
|
|
@@ -216,7 +216,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
216
216
|
context("with a namespaced ClassName (A::User)") do
|
|
217
217
|
let(:config) do
|
|
218
218
|
RuboCop::Config.new(
|
|
219
|
-
"YiffSpace/
|
|
219
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
220
220
|
"ClassName" => "A::User",
|
|
221
221
|
"IgnoredMethods" => [],
|
|
222
222
|
"IgnoredMethodPrefixes" => [],
|
|
@@ -312,7 +312,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
312
312
|
context("with a deeply namespaced ClassName (A::Util::User)") do
|
|
313
313
|
let(:config) do
|
|
314
314
|
RuboCop::Config.new(
|
|
315
|
-
"YiffSpace/
|
|
315
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
316
316
|
"ClassName" => "A::Util::User",
|
|
317
317
|
"IgnoredMethods" => [],
|
|
318
318
|
"IgnoredMethodPrefixes" => [],
|
|
@@ -358,7 +358,7 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
358
358
|
context("with a custom ClassName") do
|
|
359
359
|
let(:config) do
|
|
360
360
|
RuboCop::Config.new(
|
|
361
|
-
"YiffSpace/
|
|
361
|
+
"YiffSpace/CurrentOutsideOfRequests" => {
|
|
362
362
|
"ClassName" => "RequestUser",
|
|
363
363
|
"IgnoredMethods" => [],
|
|
364
364
|
"IgnoredMethodPrefixes" => [],
|
|
@@ -377,10 +377,10 @@ RSpec.describe(RuboCop::Cop::YiffSpace::CurrentUserOutsideOfRequests, :config) d
|
|
|
377
377
|
RUBY
|
|
378
378
|
end
|
|
379
379
|
|
|
380
|
-
it("does not register an offense for the default
|
|
380
|
+
it("does not register an offense for the default Current name") do
|
|
381
381
|
expect_no_offenses(<<~RUBY)
|
|
382
382
|
def process
|
|
383
|
-
|
|
383
|
+
Current.id
|
|
384
384
|
end
|
|
385
385
|
RUBY
|
|
386
386
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubocop-yiffspace
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Donovan_DMC
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-05-
|
|
10
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: lint_roller
|
|
@@ -75,7 +75,7 @@ files:
|
|
|
75
75
|
- lib/rubocop/cop/yiff_space/belongs_to_user.rb
|
|
76
76
|
- lib/rubocop/cop/yiff_space/belongs_to_user_invalid_ip.rb
|
|
77
77
|
- lib/rubocop/cop/yiff_space/belongs_to_user_missing_ip.rb
|
|
78
|
-
- lib/rubocop/cop/yiff_space/
|
|
78
|
+
- lib/rubocop/cop/yiff_space/current_outside_of_requests.rb
|
|
79
79
|
- lib/rubocop/cop/yiff_space/resolvable_user.rb
|
|
80
80
|
- lib/rubocop/cop/yiff_space/user_to_id.rb
|
|
81
81
|
- lib/rubocop/cop/yiffspace_cops.rb
|
|
@@ -85,7 +85,7 @@ files:
|
|
|
85
85
|
- spec/rubocop/cop/yiff_space/belongs_to_user_invalid_ip_spec.rb
|
|
86
86
|
- spec/rubocop/cop/yiff_space/belongs_to_user_missing_ip_spec.rb
|
|
87
87
|
- spec/rubocop/cop/yiff_space/belongs_to_user_spec.rb
|
|
88
|
-
- spec/rubocop/cop/yiff_space/
|
|
88
|
+
- spec/rubocop/cop/yiff_space/current_outside_of_requests_spec.rb
|
|
89
89
|
- spec/rubocop/cop/yiff_space/resolvable_user_spec.rb
|
|
90
90
|
- spec/rubocop/cop/yiff_space/user_to_id_spec.rb
|
|
91
91
|
- spec/spec_helper.rb
|