qfill 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/style.yml +37 -0
- data/.github/workflows/test.yml +55 -0
- data/.rspec +3 -2
- data/.rubocop.yml +26 -0
- data/.rubocop_todo.yml +163 -0
- data/.simplecov +6 -0
- data/CODE_OF_CONDUCT.md +133 -0
- data/Gemfile +33 -0
- data/Guardfile +12 -0
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +2 -2
- data/Rakefile +24 -1
- data/lib/qfill.rb +13 -10
- data/lib/qfill/errors/invalid_index.rb +8 -0
- data/lib/qfill/filter.rb +5 -3
- data/lib/qfill/list.rb +4 -2
- data/lib/qfill/list_set.rb +13 -9
- data/lib/qfill/manager.rb +78 -124
- data/lib/qfill/origin.rb +4 -3
- data/lib/qfill/popper.rb +30 -25
- data/lib/qfill/pusher.rb +33 -22
- data/lib/qfill/result.rb +63 -42
- data/lib/qfill/strategy.rb +13 -0
- data/lib/qfill/strategy/base.rb +65 -0
- data/lib/qfill/strategy/drain_to_empty.rb +73 -0
- data/lib/qfill/strategy/drain_to_limit.rb +46 -0
- data/lib/qfill/strategy/sample.rb +42 -0
- data/lib/qfill/strategy/time_slice.rb +106 -0
- data/lib/qfill/version.rb +3 -1
- data/maintenance-branch +1 -0
- data/qfill.gemspec +15 -13
- data/spec/qfill/filter_spec.rb +35 -26
- data/spec/qfill/list_set_spec.rb +28 -23
- data/spec/qfill/list_spec.rb +35 -27
- data/spec/qfill/manager_spec.rb +670 -434
- data/spec/qfill/origin_spec.rb +45 -35
- data/spec/qfill/popper_spec.rb +36 -30
- data/spec/qfill/pusher_spec.rb +32 -26
- data/spec/qfill/result_spec.rb +49 -38
- data/spec/qfill_spec.rb +6 -5
- data/spec/spec_helper.rb +11 -38
- data/spec/support/helper.rb +13 -0
- data/spec/support/random_object.rb +30 -0
- metadata +52 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7186df445b2f2b4c069058d078506b6182848dacd2c87b33d4ddf7acc358c78c
|
4
|
+
data.tar.gz: 8419501fe262e72e156e7def12a6fa0a08535ed080ee6c8c60c1fef8be955eb1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f46b79785bf08438e44128f53184967a8bf5f866955b7fe79a3d970a7b8798b013300f14637e7d46dfe1f6da52abf0923cd22faf5bf3283378b34c50e46e2e50
|
7
|
+
data.tar.gz: 373477a0fa69992fa1f028631f392f314c8e46f4c17266879b70e597269832050af0a7d0a67eae70aa09146de0f2b691b96bc4d3051e8faca12140b2dba5bb6d
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Code Style Checks
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'main'
|
7
|
+
- 'master'
|
8
|
+
- '*-maintenance'
|
9
|
+
- '*-dev'
|
10
|
+
tags:
|
11
|
+
- '!*' # Do not execute on tags
|
12
|
+
pull_request:
|
13
|
+
branches:
|
14
|
+
- '*'
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
rubocop:
|
18
|
+
name: Rubocop
|
19
|
+
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
ruby:
|
24
|
+
- 2.7
|
25
|
+
runs-on: ubuntu-20.04
|
26
|
+
steps:
|
27
|
+
- name: Checkout
|
28
|
+
uses: actions/checkout@v2
|
29
|
+
- name: Setup Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
33
|
+
bundler-cache: true
|
34
|
+
- name: Install dependencies
|
35
|
+
run: bundle install --jobs 3 --retry 3
|
36
|
+
- name: Run Rubocop
|
37
|
+
run: bundle exec rubocop -DESP
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: Unit Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- 'main'
|
7
|
+
- 'master'
|
8
|
+
- '*-maintenance'
|
9
|
+
- '*-dev'
|
10
|
+
tags:
|
11
|
+
- '!*' # Do not execute on tags
|
12
|
+
pull_request:
|
13
|
+
branches:
|
14
|
+
- '*'
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
name: Specs - Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }}
|
19
|
+
if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
ruby:
|
24
|
+
- 3.0.0
|
25
|
+
- 2.7
|
26
|
+
- 2.6
|
27
|
+
- 2.5
|
28
|
+
- 2.4
|
29
|
+
runs-on: ubuntu-20.04
|
30
|
+
continue-on-error: ${{ matrix.allow_failure || endsWith(matrix.ruby, 'head') }}
|
31
|
+
steps:
|
32
|
+
- uses: amancevice/setup-code-climate@v0
|
33
|
+
name: CodeClimate Install
|
34
|
+
if: matrix.ruby == '2.7' && github.event_name != 'pull_request'
|
35
|
+
with:
|
36
|
+
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
|
37
|
+
- uses: actions/checkout@v2
|
38
|
+
- name: Setup Ruby
|
39
|
+
uses: ruby/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
bundler: ${{ matrix.bundler || 2 }}
|
42
|
+
bundler-cache: true
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
- name: Install dependencies
|
45
|
+
run: bundle install --jobs 3 --retry 3 --binstubs --standalone
|
46
|
+
- name: CodeClimate Pre-build Notification
|
47
|
+
run: cc-test-reporter before-build
|
48
|
+
if: matrix.ruby == '2.7' && github.event_name != 'pull_request'
|
49
|
+
continue-on-error: ${{ matrix.allow_failures != 'false' }}
|
50
|
+
- name: Run tests
|
51
|
+
run: bundle exec rake test
|
52
|
+
- name: CodeClimate Post-build Notification
|
53
|
+
run: cc-test-reporter after-build
|
54
|
+
if: matrix.ruby == '2.7' && github.event_name != 'pull_request' && always()
|
55
|
+
continue-on-error: ${{ matrix.allow_failures != 'false' }}
|
data/.rspec
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
--
|
2
|
-
--format
|
1
|
+
--require spec_helper
|
2
|
+
--format=documentation
|
3
|
+
--colour
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require:
|
4
|
+
- 'rubocop-md'
|
5
|
+
- 'rubocop-packaging'
|
6
|
+
- 'rubocop-performance'
|
7
|
+
- 'rubocop-rake'
|
8
|
+
- 'rubocop-rspec'
|
9
|
+
|
10
|
+
AllCops:
|
11
|
+
NewCops: enable
|
12
|
+
DisplayCopNames: true # Display the name of the failing cops
|
13
|
+
Exclude:
|
14
|
+
- 'gemfiles/vendor/**/*'
|
15
|
+
- 'vendor/**/*'
|
16
|
+
|
17
|
+
Metrics/BlockLength:
|
18
|
+
IgnoredMethods:
|
19
|
+
- context
|
20
|
+
- describe
|
21
|
+
- it
|
22
|
+
- shared_context
|
23
|
+
- shared_examples
|
24
|
+
- shared_examples_for
|
25
|
+
- namespace
|
26
|
+
- draw
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2021-04-22 19:38:54 UTC using RuboCop version 1.13.0.
|
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
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'qfill.gemspec'
|
15
|
+
|
16
|
+
# Offense count: 3
|
17
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/qfill/filter_spec.rb'
|
20
|
+
|
21
|
+
# Offense count: 1
|
22
|
+
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
23
|
+
Lint/EmptyBlock:
|
24
|
+
Exclude:
|
25
|
+
- 'spec/qfill/manager_spec.rb'
|
26
|
+
|
27
|
+
# Offense count: 3
|
28
|
+
Lint/UselessAssignment:
|
29
|
+
Exclude:
|
30
|
+
- '**/*.md'
|
31
|
+
- '**/*.markdown'
|
32
|
+
- 'lib/qfill/list_set.rb'
|
33
|
+
- 'lib/qfill/popper.rb'
|
34
|
+
- 'spec/qfill/filter_spec.rb'
|
35
|
+
|
36
|
+
# Offense count: 14
|
37
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
38
|
+
Metrics/AbcSize:
|
39
|
+
Max: 39
|
40
|
+
|
41
|
+
# Offense count: 1
|
42
|
+
# Configuration parameters: CountComments, CountAsOne.
|
43
|
+
Metrics/ClassLength:
|
44
|
+
Max: 106
|
45
|
+
|
46
|
+
# Offense count: 1
|
47
|
+
# Configuration parameters: IgnoredMethods.
|
48
|
+
Metrics/CyclomaticComplexity:
|
49
|
+
Max: 8
|
50
|
+
|
51
|
+
# Offense count: 8
|
52
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
53
|
+
Metrics/MethodLength:
|
54
|
+
Max: 20
|
55
|
+
|
56
|
+
# Offense count: 1
|
57
|
+
# Configuration parameters: IgnoredMethods.
|
58
|
+
Metrics/PerceivedComplexity:
|
59
|
+
Max: 9
|
60
|
+
|
61
|
+
# Offense count: 1
|
62
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
63
|
+
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
64
|
+
Naming/MethodParameterName:
|
65
|
+
Exclude:
|
66
|
+
- 'lib/qfill/popper.rb'
|
67
|
+
|
68
|
+
# Offense count: 3
|
69
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
70
|
+
# NamePrefix: is_, has_, have_
|
71
|
+
# ForbiddenPrefixes: is_, has_, have_
|
72
|
+
# AllowedMethods: is_a?
|
73
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
74
|
+
Naming/PredicateName:
|
75
|
+
Exclude:
|
76
|
+
- 'spec/**/*'
|
77
|
+
- 'lib/qfill/manager.rb'
|
78
|
+
- 'lib/qfill/origin.rb'
|
79
|
+
- 'lib/qfill/result.rb'
|
80
|
+
|
81
|
+
# Offense count: 1
|
82
|
+
Packaging/GemspecGit:
|
83
|
+
Exclude:
|
84
|
+
- 'qfill.gemspec'
|
85
|
+
|
86
|
+
# Offense count: 22
|
87
|
+
# Configuration parameters: Prefixes.
|
88
|
+
# Prefixes: when, with, without
|
89
|
+
RSpec/ContextWording:
|
90
|
+
Exclude:
|
91
|
+
- 'spec/qfill/manager_spec.rb'
|
92
|
+
|
93
|
+
# Offense count: 1
|
94
|
+
RSpec/EmptyExampleGroup:
|
95
|
+
Exclude:
|
96
|
+
- 'spec/qfill/manager_spec.rb'
|
97
|
+
|
98
|
+
# Offense count: 45
|
99
|
+
# Configuration parameters: AssignmentOnly.
|
100
|
+
RSpec/InstanceVariable:
|
101
|
+
Exclude:
|
102
|
+
- 'spec/qfill/filter_spec.rb'
|
103
|
+
- 'spec/qfill/list_set_spec.rb'
|
104
|
+
- 'spec/qfill/list_spec.rb'
|
105
|
+
- 'spec/qfill/origin_spec.rb'
|
106
|
+
- 'spec/qfill/popper_spec.rb'
|
107
|
+
- 'spec/qfill/pusher_spec.rb'
|
108
|
+
- 'spec/qfill/result_spec.rb'
|
109
|
+
|
110
|
+
# Offense count: 7
|
111
|
+
RSpec/MultipleExpectations:
|
112
|
+
Max: 2
|
113
|
+
|
114
|
+
# Offense count: 34
|
115
|
+
RSpec/NestedGroups:
|
116
|
+
Max: 6
|
117
|
+
|
118
|
+
# Offense count: 1
|
119
|
+
Rake/Desc:
|
120
|
+
Exclude:
|
121
|
+
- 'Rakefile'
|
122
|
+
|
123
|
+
# Offense count: 14
|
124
|
+
# Configuration parameters: AllowedConstants.
|
125
|
+
Style/Documentation:
|
126
|
+
Exclude:
|
127
|
+
- '**/*.md'
|
128
|
+
- '**/*.markdown'
|
129
|
+
- 'lib/qfill/filter.rb'
|
130
|
+
- 'lib/qfill/list.rb'
|
131
|
+
- 'lib/qfill/list_set.rb'
|
132
|
+
- 'lib/qfill/manager.rb'
|
133
|
+
- 'lib/qfill/origin.rb'
|
134
|
+
- 'lib/qfill/popper.rb'
|
135
|
+
- 'lib/qfill/pusher.rb'
|
136
|
+
- 'lib/qfill/result.rb'
|
137
|
+
- 'lib/qfill/strategy/base.rb'
|
138
|
+
- 'lib/qfill/strategy/drain_to_empty.rb'
|
139
|
+
- 'lib/qfill/strategy/drain_to_limit.rb'
|
140
|
+
- 'lib/qfill/strategy/sample.rb'
|
141
|
+
- 'spec/support/helper.rb'
|
142
|
+
- 'spec/support/random_object.rb'
|
143
|
+
|
144
|
+
# Offense count: 2
|
145
|
+
# Configuration parameters: MinBodyLength.
|
146
|
+
Style/GuardClause:
|
147
|
+
Exclude:
|
148
|
+
- 'lib/qfill/pusher.rb'
|
149
|
+
- 'lib/qfill/result.rb'
|
150
|
+
|
151
|
+
# Offense count: 1
|
152
|
+
# Cop supports --auto-correct.
|
153
|
+
Style/IfUnlessModifier:
|
154
|
+
Exclude:
|
155
|
+
- 'lib/qfill/manager.rb'
|
156
|
+
|
157
|
+
# Offense count: 24
|
158
|
+
# Cop supports --auto-correct.
|
159
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
160
|
+
# URISchemes: http, https
|
161
|
+
# IgnoredPatterns: (?-mix:^\#)
|
162
|
+
Layout/LineLength:
|
163
|
+
Max: 274
|
data/.simplecov
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
|
2
|
+
# Contributor Covenant Code of Conduct
|
3
|
+
|
4
|
+
## Our Pledge
|
5
|
+
|
6
|
+
We as members, contributors, and leaders pledge to make participation in our
|
7
|
+
community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
9
|
+
identity and expression, level of experience, education, socio-economic status,
|
10
|
+
nationality, personal appearance, race, religion, or sexual identity
|
11
|
+
and orientation.
|
12
|
+
|
13
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
14
|
+
diverse, inclusive, and healthy community.
|
15
|
+
|
16
|
+
## Our Standards
|
17
|
+
|
18
|
+
Examples of behavior that contributes to a positive environment for our
|
19
|
+
community include:
|
20
|
+
|
21
|
+
* Demonstrating empathy and kindness toward other people
|
22
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
23
|
+
* Giving and gracefully accepting constructive feedback
|
24
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
25
|
+
and learning from the experience
|
26
|
+
* Focusing on what is best not just for us as individuals, but for the
|
27
|
+
overall community
|
28
|
+
|
29
|
+
Examples of unacceptable behavior include:
|
30
|
+
|
31
|
+
* The use of sexualized language or imagery, and sexual attention or
|
32
|
+
advances of any kind
|
33
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
34
|
+
* Public or private harassment
|
35
|
+
* Publishing others' private information, such as a physical or email
|
36
|
+
address, without their explicit permission
|
37
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
38
|
+
professional setting
|
39
|
+
|
40
|
+
## Enforcement Responsibilities
|
41
|
+
|
42
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
43
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
44
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
45
|
+
or harmful.
|
46
|
+
|
47
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
48
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
49
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
50
|
+
decisions when appropriate.
|
51
|
+
|
52
|
+
## Scope
|
53
|
+
|
54
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
55
|
+
an individual is officially representing the community in public spaces.
|
56
|
+
Examples of representing our community include using an official e-mail address,
|
57
|
+
posting via an official social media account, or acting as an appointed
|
58
|
+
representative at an online or offline event.
|
59
|
+
|
60
|
+
## Enforcement
|
61
|
+
|
62
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
63
|
+
reported to the community leaders responsible for enforcement at
|
64
|
+
[INSERT CONTACT METHOD].
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
66
|
+
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
68
|
+
reporter of any incident.
|
69
|
+
|
70
|
+
## Enforcement Guidelines
|
71
|
+
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
74
|
+
|
75
|
+
### 1. Correction
|
76
|
+
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
78
|
+
unprofessional or unwelcome in the community.
|
79
|
+
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
83
|
+
|
84
|
+
### 2. Warning
|
85
|
+
|
86
|
+
**Community Impact**: A violation through a single incident or series
|
87
|
+
of actions.
|
88
|
+
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
93
|
+
like social media. Violating these terms may lead to a temporary or
|
94
|
+
permanent ban.
|
95
|
+
|
96
|
+
### 3. Temporary Ban
|
97
|
+
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
99
|
+
sustained inappropriate behavior.
|
100
|
+
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
102
|
+
communication with the community for a specified period of time. No public or
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
105
|
+
Violating these terms may lead to a permanent ban.
|
106
|
+
|
107
|
+
### 4. Permanent Ban
|
108
|
+
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
112
|
+
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
114
|
+
the community.
|
115
|
+
|
116
|
+
## Attribution
|
117
|
+
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
119
|
+
version 2.0, available at
|
120
|
+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
121
|
+
|
122
|
+
Community Impact Guidelines were inspired by
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
124
|
+
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available
|
127
|
+
at [https://www.contributor-covenant.org/translations][translations].
|
128
|
+
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
130
|
+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|