shiftable 0.1.1 → 0.4.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 +4 -4
- data/CHANGELOG.md +46 -6
- data/CONTRIBUTING.md +25 -0
- data/README.md +193 -14
- data/lib/shiftable/collection.rb +38 -51
- data/lib/shiftable/mod_signature.rb +130 -0
- data/lib/shiftable/shifting.rb +38 -0
- data/lib/shiftable/shifting_record.rb +25 -0
- data/lib/shiftable/shifting_relation.rb +34 -0
- data/lib/shiftable/single.rb +38 -55
- data/lib/shiftable/version.rb +1 -1
- data/lib/shiftable.rb +5 -1
- metadata +41 -113
- data/.rspec +0 -3
- data/.rubocop.yml +0 -100
- data/.rubocop_todo.yml +0 -67
- data/Gemfile +0 -6
- data/Rakefile +0 -12
- data/bin/console +0 -15
- data/bin/setup +0 -8
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Shiftable
|
4
|
+
# Gets data to be shifted
|
5
|
+
class ShiftingRelation < Shifting
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
def found?
|
9
|
+
result.any?
|
10
|
+
end
|
11
|
+
|
12
|
+
def each(&block)
|
13
|
+
result.each(&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
# @return result (once it is shifted)
|
17
|
+
def shift
|
18
|
+
return false unless found?
|
19
|
+
|
20
|
+
each do |record|
|
21
|
+
record.send("#{column}=", to.id)
|
22
|
+
end
|
23
|
+
@run_save = yield result if block_given?
|
24
|
+
each(&:save) if run_save
|
25
|
+
result
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def query
|
31
|
+
base.where(column => from.id)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/shiftable/single.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
# extend Shiftable::Single.new(
|
14
14
|
# belongs_to: :captain,
|
15
15
|
# has_one: :spaceship,
|
16
|
-
#
|
16
|
+
# precheck: true,
|
17
17
|
# before_shift: ->(shifting:, shift_to:, shift_from:) { shifting.ownership_changes += 1 }
|
18
18
|
# )
|
19
19
|
# end
|
@@ -21,76 +21,59 @@
|
|
21
21
|
module Shiftable
|
22
22
|
# Inheriting from Module is a powerful pattern. If you like it checkout the debug_logging gem!
|
23
23
|
class Single < Module
|
24
|
-
def initialize(belongs_to:, has_one:, method_prefix: nil,
|
24
|
+
def initialize(belongs_to:, has_one:, method_prefix: nil, precheck: true, before_shift: nil)
|
25
|
+
# Ruby's Module initializer doesn't take any arguments
|
25
26
|
super()
|
26
|
-
raise ArgumentError, "belongs_to must be a symbol" unless belongs_to.is_a?(Symbol)
|
27
|
-
raise ArgumentError, "has_one must be a symbol" unless has_one.is_a?(Symbol)
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
28
|
+
@signature = ModSignature.new(
|
29
|
+
# For the following, imagine you are a Spaceship Captain, the Spaceship belongs_to you, and it has only one Captain.
|
30
|
+
# But you have to sell it to your nemesis!
|
31
|
+
associations: {
|
32
|
+
# The name of the belongs_to association, defined on the shifting model, e.g. Spaceship
|
33
|
+
# Normally a camel-cased, symbolized, version of the class name.
|
34
|
+
# In the case where Spaceship belongs_to: :captain, this is :captain.
|
35
|
+
belongs_to: belongs_to.to_s.to_sym,
|
36
|
+
# The name of the has_one association, defined on the shift_to/shift_from model, e.g. Captain.
|
37
|
+
# Normally a camel-cased, symbolized, version of the class name.
|
38
|
+
# In the case where Captain has_one: :spaceship, this is :spaceship.
|
39
|
+
has_one: has_one.to_s.to_sym
|
40
|
+
},
|
41
|
+
options: {
|
42
|
+
# Do not move record if a record already exists (we are shifting a "has_one" association, after all)
|
43
|
+
precheck: precheck,
|
44
|
+
method_prefix: method_prefix,
|
45
|
+
# will prevent the save if it returns false
|
46
|
+
# allows for any custom logic to be run, such as setting attributes, prior to the shift (save).
|
47
|
+
before_shift: before_shift
|
48
|
+
},
|
49
|
+
type: :sg
|
50
|
+
)
|
50
51
|
end
|
51
52
|
|
53
|
+
# NOTE: Possible difference in how inheritance works when using extend vs include
|
54
|
+
# with Shiftable::Single.new
|
52
55
|
def extended(base)
|
53
|
-
shift_single_modulizer = ShiftSingleModulizer.to_mod(@
|
54
|
-
@before_save)
|
56
|
+
shift_single_modulizer = ShiftSingleModulizer.to_mod(@signature.add_base(base))
|
55
57
|
base.singleton_class.send(:prepend, shift_single_modulizer)
|
56
58
|
end
|
57
59
|
|
60
|
+
# NOTE: Possible difference in how inheritance works when using extend vs include
|
61
|
+
# with Shiftable::Single.new
|
58
62
|
def included(base)
|
59
|
-
shift_single_modulizer = ShiftSingleModulizer.to_mod(@
|
60
|
-
@before_save)
|
63
|
+
shift_single_modulizer = ShiftSingleModulizer.to_mod(@signature.add_base(base))
|
61
64
|
base.send(:prepend, shift_single_modulizer)
|
62
65
|
end
|
63
66
|
|
64
67
|
# Creates anonymous Ruby Modules, containing dynamically built methods
|
65
68
|
module ShiftSingleModulizer
|
66
|
-
def to_mod(
|
69
|
+
def to_mod(signature)
|
70
|
+
prefix = signature.method_prefix
|
67
71
|
Module.new do
|
68
|
-
define_method(:"#{
|
69
|
-
|
70
|
-
reflection.foreign_key
|
71
|
-
end
|
72
|
-
define_method(:"#{mepr}shift_find") do |id|
|
73
|
-
return nil unless id
|
74
|
-
|
75
|
-
find_by(send("#{mepr}shift_column") => id)
|
72
|
+
define_method(:"#{prefix}shift_column") do
|
73
|
+
signature.shift_column
|
76
74
|
end
|
77
|
-
define_method(:"#{
|
78
|
-
|
79
|
-
return false if shift_to&.id.nil?
|
80
|
-
|
81
|
-
if preflight_checks
|
82
|
-
already_exists = shift_to.send(has_one)
|
83
|
-
return false if already_exists
|
84
|
-
end
|
85
|
-
|
86
|
-
send("#{mepr}shift_find", shift_from.id)
|
87
|
-
end
|
88
|
-
define_method(:"#{mepr}shift_single") do |shift_to:, shift_from:|
|
89
|
-
shifting = send("#{mepr}shift_safe_find", shift_to: shift_to, shift_from: shift_from)
|
90
|
-
return false unless shifting
|
91
|
-
|
92
|
-
shifting.send("#{send("#{mepr}shift_column")}=", shift_to.id)
|
93
|
-
shifting.save if before_save.nil? || before_save.call(shifting: shifting, shift_to: shift_to, shift_from: shift_from)
|
75
|
+
define_method(:"#{prefix}shift_single") do |shift_to:, shift_from:|
|
76
|
+
signature.shift_data!(shift_to: shift_to, shift_from: shift_from)
|
94
77
|
end
|
95
78
|
end
|
96
79
|
end
|
data/lib/shiftable/version.rb
CHANGED
data/lib/shiftable.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "shiftable/version"
|
4
|
-
require_relative "shiftable/
|
4
|
+
require_relative "shiftable/shifting"
|
5
|
+
require_relative "shiftable/shifting_record"
|
6
|
+
require_relative "shiftable/shifting_relation"
|
7
|
+
require_relative "shiftable/mod_signature"
|
5
8
|
require_relative "shiftable/collection"
|
9
|
+
require_relative "shiftable/single"
|
6
10
|
|
7
11
|
module Shiftable
|
8
12
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shiftable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Boling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10
|
11
|
+
date: 2021-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,210 +16,140 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5'
|
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: '
|
26
|
+
version: '5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '11.1'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '11.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: database_cleaner-active_record
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '2.0'
|
48
48
|
type: :development
|
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.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: factory_bot
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '6.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '6.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faker
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.19'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.19'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '13'
|
89
|
+
version: '13.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '13'
|
96
|
+
version: '13.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '3'
|
103
|
+
version: '3.10'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '3'
|
110
|
+
version: '3.10'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name: rspec-
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
112
|
+
name: rspec-benchmark
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - "~>"
|
130
116
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
117
|
+
version: '0.6'
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
135
121
|
requirements:
|
136
122
|
- - "~>"
|
137
123
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: rubocop-md
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
124
|
+
version: '0.6'
|
153
125
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: rubocop-rake
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: rubocop-rspec
|
126
|
+
name: rspec-block_is_expected
|
183
127
|
requirement: !ruby/object:Gem::Requirement
|
184
128
|
requirements:
|
185
129
|
- - "~>"
|
186
130
|
- !ruby/object:Gem::Version
|
187
|
-
version: '
|
131
|
+
version: '1.0'
|
188
132
|
type: :development
|
189
133
|
prerelease: false
|
190
134
|
version_requirements: !ruby/object:Gem::Requirement
|
191
135
|
requirements:
|
192
136
|
- - "~>"
|
193
137
|
- !ruby/object:Gem::Version
|
194
|
-
version: '
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: simplecov
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
138
|
+
version: '1.0'
|
209
139
|
- !ruby/object:Gem::Dependency
|
210
140
|
name: sqlite3
|
211
141
|
requirement: !ruby/object:Gem::Requirement
|
212
142
|
requirements:
|
213
|
-
- - "
|
143
|
+
- - "~>"
|
214
144
|
- !ruby/object:Gem::Version
|
215
|
-
version: '
|
145
|
+
version: '1'
|
216
146
|
type: :development
|
217
147
|
prerelease: false
|
218
148
|
version_requirements: !ruby/object:Gem::Requirement
|
219
149
|
requirements:
|
220
|
-
- - "
|
150
|
+
- - "~>"
|
221
151
|
- !ruby/object:Gem::Version
|
222
|
-
version: '
|
152
|
+
version: '1'
|
223
153
|
- !ruby/object:Gem::Dependency
|
224
154
|
name: yard
|
225
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -242,19 +172,17 @@ executables: []
|
|
242
172
|
extensions: []
|
243
173
|
extra_rdoc_files: []
|
244
174
|
files:
|
245
|
-
- ".rspec"
|
246
|
-
- ".rubocop.yml"
|
247
|
-
- ".rubocop_todo.yml"
|
248
175
|
- CHANGELOG.md
|
249
176
|
- CODE_OF_CONDUCT.md
|
250
|
-
-
|
177
|
+
- CONTRIBUTING.md
|
251
178
|
- LICENSE.txt
|
252
179
|
- README.md
|
253
|
-
- Rakefile
|
254
|
-
- bin/console
|
255
|
-
- bin/setup
|
256
180
|
- lib/shiftable.rb
|
257
181
|
- lib/shiftable/collection.rb
|
182
|
+
- lib/shiftable/mod_signature.rb
|
183
|
+
- lib/shiftable/shifting.rb
|
184
|
+
- lib/shiftable/shifting_record.rb
|
185
|
+
- lib/shiftable/shifting_relation.rb
|
258
186
|
- lib/shiftable/single.rb
|
259
187
|
- lib/shiftable/version.rb
|
260
188
|
homepage: https://railsbling.com/tags/shiftable
|
@@ -272,14 +200,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
272
200
|
requirements:
|
273
201
|
- - ">="
|
274
202
|
- !ruby/object:Gem::Version
|
275
|
-
version: 2.
|
203
|
+
version: 2.5.0
|
276
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
277
205
|
requirements:
|
278
206
|
- - ">="
|
279
207
|
- !ruby/object:Gem::Version
|
280
208
|
version: '0'
|
281
209
|
requirements: []
|
282
|
-
rubygems_version: 3.
|
210
|
+
rubygems_version: 3.0.3.1
|
283
211
|
signing_key:
|
284
212
|
specification_version: 4
|
285
213
|
summary: Easily shift record associations
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
2
|
-
|
3
|
-
AllCops:
|
4
|
-
NewCops: enable
|
5
|
-
TargetRubyVersion: 2.6
|
6
|
-
|
7
|
-
Gemspec/DateAssignment: # new in 1.10
|
8
|
-
Enabled: true
|
9
|
-
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
10
|
-
Enabled: true
|
11
|
-
Layout/SpaceBeforeBrackets: # new in 1.7
|
12
|
-
Enabled: true
|
13
|
-
Lint/AmbiguousAssignment: # new in 1.7
|
14
|
-
Enabled: true
|
15
|
-
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
16
|
-
Enabled: true
|
17
|
-
Lint/AmbiguousRange: # new in 1.19
|
18
|
-
Enabled: true
|
19
|
-
Lint/DeprecatedConstants: # new in 1.8
|
20
|
-
Enabled: true
|
21
|
-
Lint/DuplicateBranch: # new in 1.3
|
22
|
-
Enabled: true
|
23
|
-
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
24
|
-
Enabled: true
|
25
|
-
Lint/EmptyBlock: # new in 1.1
|
26
|
-
Enabled: true
|
27
|
-
Lint/EmptyClass: # new in 1.3
|
28
|
-
Enabled: true
|
29
|
-
Lint/EmptyInPattern: # new in 1.16
|
30
|
-
Enabled: true
|
31
|
-
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
32
|
-
Enabled: true
|
33
|
-
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
34
|
-
Enabled: true
|
35
|
-
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
36
|
-
Enabled: true
|
37
|
-
Lint/NumberedParameterAssignment: # new in 1.9
|
38
|
-
Enabled: true
|
39
|
-
Lint/OrAssignmentToConstant: # new in 1.9
|
40
|
-
Enabled: true
|
41
|
-
Lint/RedundantDirGlobSort: # new in 1.8
|
42
|
-
Enabled: true
|
43
|
-
Lint/RequireRelativeSelfPath: # new in 1.22
|
44
|
-
Enabled: true
|
45
|
-
Lint/SymbolConversion: # new in 1.9
|
46
|
-
Enabled: true
|
47
|
-
Lint/ToEnumArguments: # new in 1.1
|
48
|
-
Enabled: true
|
49
|
-
Lint/TripleQuotes: # new in 1.9
|
50
|
-
Enabled: true
|
51
|
-
Lint/UnexpectedBlockArity: # new in 1.5
|
52
|
-
Enabled: true
|
53
|
-
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
54
|
-
Enabled: true
|
55
|
-
Security/IoMethods: # new in 1.22
|
56
|
-
Enabled: true
|
57
|
-
Style/ArgumentsForwarding: # new in 1.1
|
58
|
-
Enabled: true
|
59
|
-
Style/CollectionCompact: # new in 1.2
|
60
|
-
Enabled: true
|
61
|
-
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
62
|
-
Enabled: true
|
63
|
-
Style/EndlessMethod: # new in 1.8
|
64
|
-
Enabled: true
|
65
|
-
Style/HashConversion: # new in 1.10
|
66
|
-
Enabled: true
|
67
|
-
Style/HashExcept: # new in 1.7
|
68
|
-
Enabled: true
|
69
|
-
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
70
|
-
Enabled: true
|
71
|
-
Style/InPatternThen: # new in 1.16
|
72
|
-
Enabled: true
|
73
|
-
Style/MultilineInPatternThen: # new in 1.16
|
74
|
-
Enabled: true
|
75
|
-
Style/NegatedIfElseCondition: # new in 1.2
|
76
|
-
Enabled: true
|
77
|
-
Style/NilLambda: # new in 1.3
|
78
|
-
Enabled: true
|
79
|
-
Style/NumberedParameters: # new in 1.22
|
80
|
-
Enabled: true
|
81
|
-
Style/NumberedParametersLimit: # new in 1.22
|
82
|
-
Enabled: true
|
83
|
-
Style/QuotedSymbols: # new in 1.16
|
84
|
-
Enabled: true
|
85
|
-
Style/RedundantArgument: # new in 1.4
|
86
|
-
Enabled: true
|
87
|
-
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
88
|
-
Enabled: true
|
89
|
-
Style/SelectByRegexp: # new in 1.22
|
90
|
-
Enabled: true
|
91
|
-
Style/StringChars: # new in 1.12
|
92
|
-
Enabled: true
|
93
|
-
Style/StringLiterals:
|
94
|
-
Enabled: true
|
95
|
-
EnforcedStyle: double_quotes
|
96
|
-
Style/StringLiteralsInInterpolation:
|
97
|
-
Enabled: true
|
98
|
-
EnforcedStyle: double_quotes
|
99
|
-
Style/SwapValues: # new in 1.1
|
100
|
-
Enabled: true
|
data/.rubocop_todo.yml
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-10-23 10:42:13 UTC using RuboCop version 1.22.2.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
12
|
-
Lint/UnusedMethodArgument:
|
13
|
-
Exclude:
|
14
|
-
- 'lib/shiftable/collection.rb'
|
15
|
-
|
16
|
-
# Offense count: 2
|
17
|
-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
18
|
-
Metrics/AbcSize:
|
19
|
-
Max: 29
|
20
|
-
|
21
|
-
# Offense count: 13
|
22
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
23
|
-
# IgnoredMethods: refine
|
24
|
-
Metrics/BlockLength:
|
25
|
-
Max: 87
|
26
|
-
|
27
|
-
# Offense count: 2
|
28
|
-
# Configuration parameters: IgnoredMethods.
|
29
|
-
Metrics/CyclomaticComplexity:
|
30
|
-
Max: 11
|
31
|
-
|
32
|
-
# Offense count: 2
|
33
|
-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
34
|
-
Metrics/MethodLength:
|
35
|
-
Max: 25
|
36
|
-
|
37
|
-
# Offense count: 2
|
38
|
-
# Configuration parameters: IgnoredMethods.
|
39
|
-
Metrics/PerceivedComplexity:
|
40
|
-
Max: 11
|
41
|
-
|
42
|
-
# Offense count: 1
|
43
|
-
Style/CombinableLoops:
|
44
|
-
Exclude:
|
45
|
-
- 'spec/shiftable/collection_spec.rb'
|
46
|
-
|
47
|
-
# Offense count: 4
|
48
|
-
# Cop supports --auto-correct.
|
49
|
-
Style/EvalWithLocation:
|
50
|
-
Exclude:
|
51
|
-
- 'spec/shiftable/collection_spec.rb'
|
52
|
-
- 'spec/shiftable/single_spec.rb'
|
53
|
-
|
54
|
-
# Offense count: 1
|
55
|
-
# Cop supports --auto-correct.
|
56
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
57
|
-
# AllowedMethods: present?, blank?, presence, try, try!
|
58
|
-
Style/SafeNavigation:
|
59
|
-
Exclude:
|
60
|
-
- 'lib/shiftable/collection.rb'
|
61
|
-
|
62
|
-
# Offense count: 7
|
63
|
-
# Cop supports --auto-correct.
|
64
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
65
|
-
# URISchemes: http, https
|
66
|
-
Layout/LineLength:
|
67
|
-
Max: 130
|
data/Gemfile
DELETED