sin_lru_redux 2.3.0 → 2.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a205e8ba667a41a33f3b7fdb9d86e6ab3cc5623aff0998a31e00899db3069535
4
- data.tar.gz: 6b3cad6832644bdc3c8ec26e821f7ff855f1591c99be6a127ba55b048943f1e2
3
+ metadata.gz: 9d2e703acd20c2c53c25cd48b9825141b56dbccc618922b8ce9cbacb775f34d7
4
+ data.tar.gz: d4a5fc8a84c63320d0194aa22f5d6bbf6b85de284b8793bec2b9f70e5d1493cd
5
5
  SHA512:
6
- metadata.gz: 63f527c1469a8cc98b48be9c9248bd6406d75db63443930368e328106048d4aafaba3f9f560d63ab4e535c832d9485b90e69039c5b496999fd91535411116a1e
7
- data.tar.gz: f10d3bb3ec140660b562f8246eaa89acf1bbe6b497b5d283d5494b4ac57cce1621ab932fc4f55cc70dc995fd933ba12fa71d72311683e31c93a2bd37d184fe4b
6
+ metadata.gz: 5f23cdad526c465dc8932e8ab9ac4e533cec384ee745c130ce0c4253637318db2e8754485a7bbbab2df70e8d927f258751d2f6dd296997f0d835aad9afd1f611
7
+ data.tar.gz: c00bc3cbd2dd6a496165b91c979336f3a247bdced9d6b0bc4feff6c87e4f301bb67ac518b625bb9897fcbb59b5e5fc8127ebec89d9aa2e4ce7c99140a9c33b1e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.5.0] - 2025-1-17
4
+
5
+ - New: Add SinLruRedux module compatible with LruRedux module
6
+ - Refactor: Improve implementation
7
+ - Test: Improve tests
8
+ - Other: Improve CI
9
+ - Other: Fix README.md
10
+
11
+ ## [2.4.0] - 2025-1-2
12
+
13
+ - New: Be able to require `sin_lru_redux` instead of `lru_redux`
14
+ - Other: Update .rubocop.yml
15
+ - Other: Add how to sponsor
16
+
3
17
  ## [2.3.0] - 2025-1-1
4
18
 
5
19
  - New: Add alias method `length` and `size` for `count`
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SinLruRedux
2
2
 
3
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cadenza-tech/sin_lru_redux/blob/main/LICENSE.txt) [![tag](https://img.shields.io/github/tag/cadenza-tech/sin_lru_redux.svg?logo=github&color=2EBC4F)](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CHANGELOG.md) [![release](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/release.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Arelease) [![test](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/test.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Arelease) [![lint](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/lint.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Arelease)
3
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/cadenza-tech/sin_lru_redux/blob/main/LICENSE.txt) [![tag](https://img.shields.io/github/tag/cadenza-tech/sin_lru_redux.svg?logo=github&color=2EBC4F)](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CHANGELOG.md) [![release](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/release.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Arelease) [![test](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/test.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Atest) [![lint](https://github.com/cadenza-tech/sin_lru_redux/actions/workflows/lint.yml/badge.svg)](https://github.com/cadenza-tech/sin_lru_redux/actions?query=workflow%3Alint)
4
4
 
5
5
  Efficient and thread-safe LRU cache.
6
6
 
@@ -8,12 +8,12 @@ Forked from [LruRedux](https://github.com/SamSaffron/lru_redux).
8
8
 
9
9
  - [Installation](#installation)
10
10
  - [Usage](#usage)
11
- - [TTL Cache](#ttl-cache)
12
11
  - [Cache Methods](#cache-methods)
12
+ - [Changelog](#changelog)
13
13
  - [Contributing](#contributing)
14
- - [Changelog](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CHANGELOG.md)
15
14
  - [License](#license)
16
15
  - [Code of Conduct](#code-of-conduct)
16
+ - [Sponsor](#sponsor)
17
17
 
18
18
  ## Installation
19
19
 
@@ -163,6 +163,10 @@ cache = LruRedux::TTL::ThreadSafeCache.new(100, 5 * 60)
163
163
  - `#ttl=` Takes `:none` or a positive number. Changes the current ttl and triggers a TTL eviction.
164
164
  - `#expire` Triggers a TTL eviction.
165
165
 
166
+ ## Changelog
167
+
168
+ See [CHANGELOG.md](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CHANGELOG.md).
169
+
166
170
  ## Contributing
167
171
 
168
172
  Bug reports and pull requests are welcome on GitHub at https://github.com/cadenza-tech/sin_lru_redux. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CODE_OF_CONDUCT.md).
@@ -174,3 +178,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
174
178
  ## Code of Conduct
175
179
 
176
180
  Everyone interacting in the SinLruRedux project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/cadenza-tech/sin_lru_redux/blob/main/CODE_OF_CONDUCT.md).
181
+
182
+ ## Sponsor
183
+
184
+ You can sponsor this project on [Patreon](https://patreon.com/CadenzaTech).
data/Rakefile CHANGED
@@ -4,8 +4,8 @@ require 'bundler/gem_tasks'
4
4
  require 'rake/testtask'
5
5
  require 'rubocop/rake_task'
6
6
 
7
- Rake::TestTask.new(:test) do |t|
8
- t.pattern = 'test/**/test_*.rb'
7
+ Rake::TestTask.new(:test) do |task|
8
+ task.pattern = 'test/**/test_*.rb'
9
9
  end
10
10
 
11
11
  RuboCop::RakeTask.new
@@ -1,163 +1,165 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class LruRedux::Cache
4
- attr_reader :max_size, :ignore_nil
3
+ module LruRedux
4
+ class Cache
5
+ attr_reader :max_size, :ignore_nil
5
6
 
6
- def initialize(*args)
7
- max_size, ignore_nil, _ = args
7
+ def initialize(*args)
8
+ max_size, ignore_nil, _ = args
8
9
 
9
- max_size ||= 1000
10
- ignore_nil ||= false
10
+ max_size ||= 1000
11
+ ignore_nil ||= false
11
12
 
12
- validate_max_size!(max_size)
13
- validate_ignore_nil!(ignore_nil)
13
+ validate_max_size!(max_size)
14
+ validate_ignore_nil!(ignore_nil)
14
15
 
15
- @max_size = max_size
16
- @ignore_nil = ignore_nil
17
- @data_lru = {}
18
- end
16
+ @max_size = max_size
17
+ @ignore_nil = ignore_nil
18
+ @data_lru = {}
19
+ end
19
20
 
20
- def max_size=(new_max_size)
21
- validate_max_size!(new_max_size)
21
+ def max_size=(new_max_size)
22
+ validate_max_size!(new_max_size)
22
23
 
23
- @max_size = new_max_size
24
- evict_excess
25
- end
24
+ @max_size = new_max_size
25
+ evict_excess
26
+ end
26
27
 
27
- def ttl=(_)
28
- nil
29
- end
28
+ def ttl=(_)
29
+ nil
30
+ end
30
31
 
31
- def ignore_nil=(new_ignore_nil)
32
- validate_ignore_nil!(new_ignore_nil)
32
+ def ignore_nil=(new_ignore_nil)
33
+ validate_ignore_nil!(new_ignore_nil)
33
34
 
34
- @ignore_nil = new_ignore_nil
35
- evict_nil
36
- end
35
+ @ignore_nil = new_ignore_nil
36
+ evict_nil
37
+ end
38
+
39
+ def getset(key)
40
+ key_found = true
41
+ value = @data_lru.delete(key) { key_found = false }
42
+
43
+ if key_found
44
+ @data_lru[key] = value
45
+ else
46
+ result = yield
47
+ store_item(key, result)
48
+ result
49
+ end
50
+ end
37
51
 
38
- def getset(key)
39
- key_found = true
40
- value = @data_lru.delete(key) { key_found = false }
52
+ def fetch(key)
53
+ key_found = true
54
+ value = @data_lru.delete(key) { key_found = false }
41
55
 
42
- if key_found
43
- @data_lru[key] = value
44
- else
45
- result = yield
46
- store_item(key, result)
47
- result
56
+ if key_found
57
+ @data_lru[key] = value
58
+ else
59
+ yield if block_given? # rubocop:disable Style/IfInsideElse
60
+ end
48
61
  end
49
- end
50
62
 
51
- def fetch(key)
52
- key_found = true
53
- value = @data_lru.delete(key) { key_found = false }
63
+ def [](key)
64
+ key_found = true
65
+ value = @data_lru.delete(key) { key_found = false }
66
+ return unless key_found
54
67
 
55
- if key_found
56
68
  @data_lru[key] = value
57
- else
58
- yield if block_given? # rubocop:disable Style/IfInsideElse
59
69
  end
60
- end
61
70
 
62
- def [](key)
63
- key_found = true
64
- value = @data_lru.delete(key) { key_found = false }
65
- return unless key_found
66
-
67
- @data_lru[key] = value
68
- end
71
+ def []=(key, val)
72
+ store_item(key, val)
73
+ end
69
74
 
70
- def []=(key, val)
71
- store_item(key, val)
72
- end
75
+ def each(&block)
76
+ @data_lru.to_a.reverse_each(&block)
77
+ end
78
+ # Used further up the chain, non thread safe each
79
+ alias_method :each_unsafe, :each
73
80
 
74
- def each(&block)
75
- @data_lru.to_a.reverse_each(&block)
76
- end
77
- # Used further up the chain, non thread safe each
78
- alias_method :each_unsafe, :each
81
+ def to_a
82
+ @data_lru.to_a.reverse
83
+ end
79
84
 
80
- def to_a
81
- @data_lru.to_a.reverse
82
- end
85
+ def values
86
+ @data_lru.values.reverse
87
+ end
83
88
 
84
- def values
85
- @data_lru.values.reverse
86
- end
89
+ def delete(key)
90
+ @data_lru.delete(key)
91
+ end
92
+ alias_method :evict, :delete
87
93
 
88
- def delete(key)
89
- @data_lru.delete(key)
90
- end
91
- alias_method :evict, :delete
94
+ def key?(key)
95
+ @data_lru.key?(key)
96
+ end
97
+ alias_method :has_key?, :key?
92
98
 
93
- def key?(key)
94
- @data_lru.key?(key)
95
- end
96
- alias_method :has_key?, :key?
99
+ def clear
100
+ @data_lru.clear
101
+ end
97
102
 
98
- def clear
99
- @data_lru.clear
100
- end
103
+ def count
104
+ @data_lru.size
105
+ end
106
+ alias_method :length, :count
107
+ alias_method :size, :count
101
108
 
102
- def count
103
- @data_lru.size
104
- end
105
- alias_method :length, :count
106
- alias_method :size, :count
109
+ private
107
110
 
108
- private
111
+ # For cache validation only, ensure all is valid
112
+ def valid?
113
+ true
114
+ end
109
115
 
110
- # For cache validation only, ensure all is valid
111
- def valid?
112
- true
113
- end
116
+ def validate_max_size!(max_size)
117
+ unless max_size.is_a?(Numeric)
118
+ raise ArgumentError.new(<<~ERROR)
119
+ Invalid max_size: #{max_size.inspect}
120
+ max_size must be a number.
121
+ ERROR
122
+ end
123
+ return if max_size >= 1
114
124
 
115
- def validate_max_size!(max_size)
116
- unless max_size.is_a?(Numeric)
117
125
  raise ArgumentError.new(<<~ERROR)
118
126
  Invalid max_size: #{max_size.inspect}
119
- max_size must be a number.
127
+ max_size must be greater than or equal to 1.
120
128
  ERROR
121
129
  end
122
- return if max_size >= 1
123
130
 
124
- raise ArgumentError.new(<<~ERROR)
125
- Invalid max_size: #{max_size.inspect}
126
- max_size must be greater than or equal to 1.
127
- ERROR
128
- end
131
+ def validate_ignore_nil!(ignore_nil)
132
+ return if [true, false].include?(ignore_nil)
129
133
 
130
- def validate_ignore_nil!(ignore_nil)
131
- return if [true, false].include?(ignore_nil)
134
+ raise ArgumentError.new(<<~ERROR)
135
+ Invalid ignore_nil: #{ignore_nil.inspect}
136
+ ignore_nil must be a boolean value.
137
+ ERROR
138
+ end
132
139
 
133
- raise ArgumentError.new(<<~ERROR)
134
- Invalid ignore_nil: #{ignore_nil.inspect}
135
- ignore_nil must be a boolean value.
136
- ERROR
137
- end
140
+ def evict_excess
141
+ @data_lru.shift while @data_lru.size > @max_size
142
+ end
138
143
 
139
- def evict_excess
140
- @data_lru.shift while @data_lru.size > @max_size
141
- end
144
+ if RUBY_VERSION >= '2.6.0'
145
+ def evict_nil
146
+ return unless @ignore_nil
142
147
 
143
- if RUBY_VERSION >= '2.6.0'
144
- def evict_nil
145
- return unless @ignore_nil
148
+ @data_lru.compact!
149
+ end
150
+ else
151
+ def evict_nil
152
+ return unless @ignore_nil
146
153
 
147
- @data_lru.compact!
154
+ @data_lru.reject! { |_key, value| value.nil? }
155
+ end
148
156
  end
149
- else
150
- def evict_nil
151
- return unless @ignore_nil
152
157
 
153
- @data_lru.reject! { |_key, value| value.nil? }
158
+ def store_item(key, val)
159
+ @data_lru.delete(key)
160
+ @data_lru[key] = val if !val.nil? || !@ignore_nil
161
+ evict_excess
162
+ val
154
163
  end
155
164
  end
156
-
157
- def store_item(key, val)
158
- @data_lru.delete(key)
159
- @data_lru[key] = val if !val.nil? || !@ignore_nil
160
- evict_excess
161
- val
162
- end
163
165
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class LruRedux::ThreadSafeCache < LruRedux::Cache
4
- include LruRedux::Util::SafeSync
3
+ module LruRedux
4
+ class ThreadSafeCache < Cache
5
+ include ::LruRedux::Util::SafeSync
6
+ end
5
7
  end
@@ -1,5 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class LruRedux::TTL::ThreadSafeCache < LruRedux::TTL::Cache
4
- include LruRedux::Util::SafeSync
3
+ module LruRedux
4
+ module TTL
5
+ class ThreadSafeCache < Cache
6
+ include ::LruRedux::Util::SafeSync
7
+ end
8
+ end
5
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LruRedux
4
- VERSION = '2.3.0'
4
+ VERSION = '2.5.0'
5
5
  end
data/lib/lru_redux.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'lru_redux/version'
3
4
  require 'lru_redux/util'
4
5
  require 'lru_redux/cache'
5
6
  require 'lru_redux/thread_safe_cache'
6
7
  require 'lru_redux/ttl'
7
- require 'lru_redux/version'
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lru_redux/cache'
4
+
5
+ module SinLruRedux
6
+ class Cache < ::LruRedux::Cache
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SinLruRedux
4
+ class ThreadSafeCache < Cache
5
+ include ::SinLruRedux::Util::SafeSync
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../lru_redux/ttl/cache'
4
+
5
+ module SinLruRedux
6
+ module TTL
7
+ class Cache < ::LruRedux::TTL::Cache
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SinLruRedux
4
+ module TTL
5
+ class ThreadSafeCache < Cache
6
+ include ::SinLruRedux::Util::SafeSync
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sin_lru_redux/util'
4
+ require 'sin_lru_redux/ttl/cache'
5
+ require 'sin_lru_redux/ttl/thread_safe_cache'
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../../lru_redux/util/safe_sync'
4
+
5
+ module SinLruRedux
6
+ module Util
7
+ module SafeSync
8
+ include ::LruRedux::Util::SafeSync
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sin_lru_redux/util/safe_sync'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../lru_redux/version'
4
+
5
+ module SinLruRedux
6
+ VERSION = ::LruRedux::VERSION
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lru_redux'
4
+ require 'sin_lru_redux/version'
5
+ require 'sin_lru_redux/util'
6
+ require 'sin_lru_redux/cache'
7
+ require 'sin_lru_redux/thread_safe_cache'
8
+ require 'sin_lru_redux/ttl'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sin_lru_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-01 00:00:00.000000000 Z
10
+ date: 2025-01-17 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: |
13
13
  Efficient and thread-safe LRU cache.
@@ -18,9 +18,7 @@ executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - ".rubocop.yml"
22
21
  - CHANGELOG.md
23
- - CODE_OF_CONDUCT.md
24
22
  - LICENSE.txt
25
23
  - README.md
26
24
  - Rakefile
@@ -33,16 +31,29 @@ files:
33
31
  - lib/lru_redux/util.rb
34
32
  - lib/lru_redux/util/safe_sync.rb
35
33
  - lib/lru_redux/version.rb
36
- homepage: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.3.0
34
+ - lib/sin_lru_redux.rb
35
+ - lib/sin_lru_redux/cache.rb
36
+ - lib/sin_lru_redux/thread_safe_cache.rb
37
+ - lib/sin_lru_redux/ttl.rb
38
+ - lib/sin_lru_redux/ttl/cache.rb
39
+ - lib/sin_lru_redux/ttl/thread_safe_cache.rb
40
+ - lib/sin_lru_redux/util.rb
41
+ - lib/sin_lru_redux/util/safe_sync.rb
42
+ - lib/sin_lru_redux/version.rb
43
+ homepage: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.5.0
37
44
  licenses:
38
45
  - MIT
39
46
  metadata:
40
- homepage_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.3.0
41
- source_code_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.3.0
42
- changelog_uri: https://github.com/cadenza-tech/sin_lru_redux/blob/v2.3.0/CHANGELOG.md
47
+ homepage_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.5.0
48
+ source_code_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.5.0
49
+ changelog_uri: https://github.com/cadenza-tech/sin_lru_redux/blob/v2.5.0/CHANGELOG.md
43
50
  bug_tracker_uri: https://github.com/cadenza-tech/sin_lru_redux/issues
44
- documentation_uri: https://rubydoc.info/gems/sin_lru_redux/2.3.0
51
+ documentation_uri: https://rubydoc.info/gems/sin_lru_redux/2.5.0
52
+ funding_uri: https://patreon.com/CadenzaTech
45
53
  rubygems_mfa_required: 'true'
54
+ required_jruby_version: ">= 9.4.0.0"
55
+ required_truffleruby_version: ">= 22.0.0"
56
+ required_truffleruby+graalvm_version: ">= 22.0.0"
46
57
  rdoc_options: []
47
58
  require_paths:
48
59
  - lib
data/.rubocop.yml DELETED
@@ -1,202 +0,0 @@
1
- require:
2
- - rubocop-minitest
3
- - rubocop-performance
4
- - rubocop-rake
5
-
6
- AllCops:
7
- TargetRubyVersion: 2.3
8
- NewCops: enable
9
-
10
- # https://docs.rubocop.org/rubocop/cops_gemspec.html#gemspecrequiredrubyversion
11
- Gemspec/RequiredRubyVersion:
12
- Enabled: false
13
-
14
- # https://docs.rubocop.org/rubocop/cops_layout.html#layoutfirstarrayelementindentation
15
- Layout/FirstArrayElementIndentation:
16
- Enabled: true
17
- EnforcedStyle: consistent
18
-
19
- # https://docs.rubocop.org/rubocop/cops_layout.html#layoutlinelength
20
- Layout/LineLength:
21
- Enabled: true
22
- Max: 150
23
- AllowURI: false
24
-
25
- # https://docs.rubocop.org/rubocop/cops_lint.html#lintmissingsuper
26
- Lint/MissingSuper:
27
- Enabled: true
28
- Exclude:
29
- - 'app/views/components/**/component.rb'
30
-
31
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsabcsize
32
- Metrics/AbcSize:
33
- Enabled: true
34
- Max: 30
35
-
36
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocklength
37
- Metrics/BlockLength:
38
- Enabled: true
39
- Max: 30
40
- Exclude:
41
- - 'config/routes.rb'
42
- - 'db/seeds.rb'
43
- - 'spec/**/*_spec.rb'
44
-
45
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsblocknesting
46
- Metrics/BlockNesting:
47
- Enabled: true
48
- Max: 3
49
-
50
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsclasslength
51
- Metrics/ClassLength:
52
- Enabled: true
53
- CountComments: false
54
- Max: 400
55
-
56
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricscyclomaticcomplexity
57
- Metrics/CyclomaticComplexity:
58
- Enabled: true
59
- Max: 20
60
-
61
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmethodlength
62
- Metrics/MethodLength:
63
- Enabled: true
64
- CountComments: false
65
- Max: 25
66
-
67
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsmodulelength
68
- Metrics/ModuleLength:
69
- Enabled: true
70
- Max: 200
71
-
72
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsparameterlists
73
- Metrics/ParameterLists:
74
- Enabled: true
75
- Max: 5
76
- CountKeywordArgs: true
77
-
78
- # https://docs.rubocop.org/rubocop/cops_metrics.html#metricsperceivedcomplexity
79
- Metrics/PerceivedComplexity:
80
- Enabled: true
81
- Max: 20
82
-
83
- # https://docs.rubocop.org/rubocop/cops_naming.html#namingaccessormethodname
84
- Naming/AccessorMethodName:
85
- Enabled: false
86
-
87
- # https://docs.rubocop.org/rubocop/cops_naming.html#namingblockforwarding
88
- Naming/BlockForwarding:
89
- Enabled: true
90
- EnforcedStyle: explicit
91
-
92
- # https://docs.rubocop.org/rubocop/cops_naming.html#namingmemoizedinstancevariablename
93
- Naming/MemoizedInstanceVariableName:
94
- Enabled: false
95
-
96
- # https://docs.rubocop.org/rubocop/cops_style.html#styleaccessmodifierdeclarations
97
- Style/AccessModifierDeclarations:
98
- Enabled: true
99
- AllowModifiersOnSymbols: false
100
-
101
- # https://docs.rubocop.org/rubocop/cops_style.html#stylealias
102
- Style/Alias:
103
- Enabled: true
104
- EnforcedStyle: prefer_alias_method
105
-
106
- # https://docs.rubocop.org/rubocop/cops_style.html#styleargumentsforwarding
107
- Style/ArgumentsForwarding:
108
- Enabled: true
109
- UseAnonymousForwarding: false
110
-
111
- # https://docs.rubocop.org/rubocop/cops_style.html#styleasciicomments
112
- Style/AsciiComments:
113
- Enabled: false
114
-
115
- # https://docs.rubocop.org/rubocop/cops_style.html#styleblockcomments
116
- Style/BlockComments:
117
- Enabled: true
118
- Exclude:
119
- - 'spec/spec_helper.rb'
120
-
121
- # https://docs.rubocop.org/rubocop/cops_style.html#styleclassandmodulechildren
122
- Style/ClassAndModuleChildren:
123
- Enabled: false
124
-
125
- # https://docs.rubocop.org/rubocop/cops_style.html#stylecollectionmethods
126
- Style/CollectionMethods:
127
- Enabled: true
128
- PreferredMethods:
129
- detect: 'detect'
130
- find: 'detect'
131
- inject: 'inject'
132
- reduce: 'inject'
133
-
134
- # https://docs.rubocop.org/rubocop/cops_style.html#styleconditionalassignment
135
- Style/ConditionalAssignment:
136
- Enabled: true
137
- EnforcedStyle: assign_inside_condition
138
-
139
- # https://docs.rubocop.org/rubocop/cops_style.html#styledocumentation
140
- Style/Documentation:
141
- Enabled: false
142
-
143
- # https://docs.rubocop.org/rubocop/cops_style.html#styleemptymethod
144
- Style/EmptyMethod:
145
- Enabled: true
146
- EnforcedStyle: expanded
147
-
148
- # https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax
149
- Style/HashSyntax:
150
- Enabled: true
151
- EnforcedStyle: ruby19_no_mixed_keys
152
- EnforcedShorthandSyntax: never
153
-
154
- # https://docs.rubocop.org/rubocop/cops_style.html#stylelambda
155
- Style/Lambda:
156
- Enabled: true
157
- EnforcedStyle: literal
158
-
159
- # https://docs.rubocop.org/rubocop/cops_style.html#stylelineendconcatenation
160
- Style/LineEndConcatenation:
161
- Enabled: false
162
-
163
- # https://docs.rubocop.org/rubocop/cops_style.html#stylenumericliterals
164
- Style/NumericLiterals:
165
- Enabled: false
166
-
167
- # https://docs.rubocop.org/rubocop/cops_style.html#stylenumericpredicate
168
- Style/NumericPredicate:
169
- Enabled: true
170
- EnforcedStyle: comparison
171
-
172
- # https://docs.rubocop.org/rubocop/cops_style.html#styleraiseargs
173
- Style/RaiseArgs:
174
- Enabled: true
175
- EnforcedStyle: compact
176
-
177
- # https://docs.rubocop.org/rubocop/cops_style.html#stylesuperarguments
178
- Style/SuperArguments:
179
- Enabled: false
180
-
181
- # https://docs.rubocop.org/rubocop/cops_style.html#stylesymbolarray
182
- Style/SymbolArray:
183
- Enabled: true
184
- EnforcedStyle: brackets
185
-
186
- # https://docs.rubocop.org/rubocop/cops_style.html#styleternaryparentheses
187
- Style/TernaryParentheses:
188
- Enabled: true
189
- EnforcedStyle: require_parentheses_when_complex
190
- AllowSafeAssignment: false
191
-
192
- # https://docs.rubocop.org/rubocop/cops_style.html#styletrailingunderscorevariable
193
- Style/TrailingUnderscoreVariable:
194
- Enabled: false
195
-
196
- # https://docs.rubocop.org/rubocop/cops_style.html#styleunpackfirst
197
- Style/UnpackFirst:
198
- Enabled: false
199
-
200
- # https://docs.rubocop.org/rubocop/cops_style.html#stylewordarray
201
- Style/WordArray:
202
- Enabled: false
data/CODE_OF_CONDUCT.md DELETED
@@ -1,132 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- We as members, contributors, and leaders pledge to make participation in our
6
- community a harassment-free experience for everyone, regardless of age, body
7
- size, visible or invisible disability, ethnicity, sex characteristics, gender
8
- identity and expression, level of experience, education, socio-economic status,
9
- nationality, personal appearance, race, caste, color, religion, or sexual
10
- identity and orientation.
11
-
12
- We pledge to act and interact in ways that contribute to an open, welcoming,
13
- diverse, inclusive, and healthy community.
14
-
15
- ## Our Standards
16
-
17
- Examples of behavior that contributes to a positive environment for our
18
- community include:
19
-
20
- * Demonstrating empathy and kindness toward other people
21
- * Being respectful of differing opinions, viewpoints, and experiences
22
- * Giving and gracefully accepting constructive feedback
23
- * Accepting responsibility and apologizing to those affected by our mistakes,
24
- and learning from the experience
25
- * Focusing on what is best not just for us as individuals, but for the overall
26
- community
27
-
28
- Examples of unacceptable behavior include:
29
-
30
- * The use of sexualized language or imagery, and sexual attention or advances of
31
- any kind
32
- * Trolling, insulting or derogatory comments, and personal or political attacks
33
- * Public or private harassment
34
- * Publishing others' private information, such as a physical or email address,
35
- without their explicit permission
36
- * Other conduct which could reasonably be considered inappropriate in a
37
- professional setting
38
-
39
- ## Enforcement Responsibilities
40
-
41
- Community leaders are responsible for clarifying and enforcing our standards of
42
- acceptable behavior and will take appropriate and fair corrective action in
43
- response to any behavior that they deem inappropriate, threatening, offensive,
44
- or harmful.
45
-
46
- Community leaders have the right and responsibility to remove, edit, or reject
47
- comments, commits, code, wiki edits, issues, and other contributions that are
48
- not aligned to this Code of Conduct, and will communicate reasons for moderation
49
- decisions when appropriate.
50
-
51
- ## Scope
52
-
53
- This Code of Conduct applies within all community spaces, and also applies when
54
- an individual is officially representing the community in public spaces.
55
- Examples of representing our community include using an official email address,
56
- posting via an official social media account, or acting as an appointed
57
- representative at an online or offline event.
58
-
59
- ## Enforcement
60
-
61
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
- reported to the community leaders responsible for enforcement at
63
- [INSERT CONTACT METHOD].
64
- All complaints will be reviewed and investigated promptly and fairly.
65
-
66
- All community leaders are obligated to respect the privacy and security of the
67
- reporter of any incident.
68
-
69
- ## Enforcement Guidelines
70
-
71
- Community leaders will follow these Community Impact Guidelines in determining
72
- the consequences for any action they deem in violation of this Code of Conduct:
73
-
74
- ### 1. Correction
75
-
76
- **Community Impact**: Use of inappropriate language or other behavior deemed
77
- unprofessional or unwelcome in the community.
78
-
79
- **Consequence**: A private, written warning from community leaders, providing
80
- clarity around the nature of the violation and an explanation of why the
81
- behavior was inappropriate. A public apology may be requested.
82
-
83
- ### 2. Warning
84
-
85
- **Community Impact**: A violation through a single incident or series of
86
- actions.
87
-
88
- **Consequence**: A warning with consequences for continued behavior. No
89
- interaction with the people involved, including unsolicited interaction with
90
- those enforcing the Code of Conduct, for a specified period of time. This
91
- includes avoiding interactions in community spaces as well as external channels
92
- like social media. Violating these terms may lead to a temporary or permanent
93
- ban.
94
-
95
- ### 3. Temporary Ban
96
-
97
- **Community Impact**: A serious violation of community standards, including
98
- sustained inappropriate behavior.
99
-
100
- **Consequence**: A temporary ban from any sort of interaction or public
101
- communication with the community for a specified period of time. No public or
102
- private interaction with the people involved, including unsolicited interaction
103
- with those enforcing the Code of Conduct, is allowed during this period.
104
- Violating these terms may lead to a permanent ban.
105
-
106
- ### 4. Permanent Ban
107
-
108
- **Community Impact**: Demonstrating a pattern of violation of community
109
- standards, including sustained inappropriate behavior, harassment of an
110
- individual, or aggression toward or disparagement of classes of individuals.
111
-
112
- **Consequence**: A permanent ban from any sort of public interaction within the
113
- community.
114
-
115
- ## Attribution
116
-
117
- This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
- version 2.1, available at
119
- [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
-
121
- Community Impact Guidelines were inspired by
122
- [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
-
124
- For answers to common questions about this code of conduct, see the FAQ at
125
- [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
- [https://www.contributor-covenant.org/translations][translations].
127
-
128
- [homepage]: https://www.contributor-covenant.org
129
- [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
- [Mozilla CoC]: https://github.com/mozilla/diversity
131
- [FAQ]: https://www.contributor-covenant.org/faq
132
- [translations]: https://www.contributor-covenant.org/translations