Skip to content

Commit e60271d

Browse files
Add modern Rubies to CI. Fix unquoted 3.0. Update gems. Set minimum Ruby to 2.7
1 parent 69d8767 commit e60271d

11 files changed

Lines changed: 55 additions & 40 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ jobs:
55
build:
66
runs-on: ubuntu-latest
77
steps:
8-
- uses: actions/checkout@v1
8+
- uses: actions/checkout@v3
99
- name: Install Ruby (2.7)
10-
uses: actions/setup-ruby@v1
10+
uses: ruby/setup-ruby@v1
1111
with:
12-
ruby-version: 2.7.x
12+
ruby-version: 2.7
1313
- uses: amancevice/setup-code-climate@v0
1414
with:
1515
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}

.github/workflows/danger.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ jobs:
77
danger:
88
runs-on: ubuntu-20.04
99
steps:
10-
- uses: actions/checkout@v1
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
1113
- name: Set up Ruby
1214
uses: ruby/setup-ruby@v1
1315
with:
14-
ruby-version: 2.6
16+
ruby-version: 2.7
1517
bundler-cache: true
1618
- name: Run Danger
1719
run: |
1820
# the personal token is public, this is ok, base64 encode to avoid tripping Github
19-
TOKEN=$(echo -n NWY1ZmM5MzEyMzNlYWY4OTZiOGU3MmI3MWQ3Mzk0MzgxMWE4OGVmYwo= | base64 --decode)
21+
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
2022
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose

.github/workflows/lint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint
2+
on: [push, pull_request]
3+
jobs:
4+
rubocop:
5+
name: RuboCop
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v3
10+
- name: Set up Ruby
11+
uses: ruby/setup-ruby@v1
12+
with:
13+
with:
14+
ruby-version: 2.7
15+
bundler-cache: true
16+
- run: bundle exec rubocop
17+

.github/workflows/test.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,22 @@
22
name: test
33
on: [push, pull_request]
44
jobs:
5-
lint:
6-
name: RuboCop
7-
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
10-
- name: Set up Ruby
11-
uses: ruby/setup-ruby@v1
12-
with:
13-
ruby-version: 2.7
14-
bundler-cache: true
15-
- name: Run RuboCop
16-
run: bundle exec rubocop
175
test:
186
runs-on: ubuntu-latest
197
strategy:
8+
fail-fast: false
209
matrix:
2110
entry:
22-
- { ruby: 2.4, allowed-failure: false }
23-
- { ruby: 2.5, allowed-failure: false }
24-
- { ruby: 2.6, allowed-failure: false }
25-
- { ruby: 2.7, allowed-failure: false }
26-
- { ruby: 3.0, allowed-failure: false }
27-
- { ruby: ruby-head, allowed-failure: true }
28-
- { ruby: truffleruby-head, allowed-failure: true }
29-
- { ruby: jruby-head, allowed-failure: true }
11+
- { ruby: '2.7', allowed-failure: false }
12+
- { ruby: '3.0', allowed-failure: false }
13+
- { ruby: '3.1', allowed-failure: false }
14+
- { ruby: '3.2', allowed-failure: false }
15+
- { ruby: 'ruby-head', allowed-failure: true }
16+
- { ruby: 'truffleruby-head', allowed-failure: true }
17+
- { ruby: 'jruby-head', allowed-failure: true }
3018
name: test (${{ matrix.entry.ruby }})
3119
steps:
32-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
3321
- uses: ruby/setup-ruby@v1
3422
with:
3523
ruby-version: ${{ matrix.entry.ruby }}

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.3
2+
TargetRubyVersion: 2.7
33
Exclude:
44
- vendor/**/*
55

.rubocop_todo.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2020-03-27 09:23:34 -0400 using RuboCop version 0.80.1.
3+
# on 2023-02-13 20:38:06 UTC using RuboCop version 1.45.1.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 4
10+
# Configuration parameters: AllowedMethods.
11+
# AllowedMethods: enums
12+
Lint/ConstantDefinitionInBlock:
13+
Exclude:
14+
- 'spec/ruby-enum/enum_spec.rb'
15+
916
# Offense count: 1
10-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
17+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
18+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
1119
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
1220
Naming/FileName:
1321
Exclude:
1422
- 'lib/ruby-enum.rb'
1523

1624
# Offense count: 6
1725
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
18-
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
26+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
1927
Naming/MethodParameterName:
2028
Exclude:
2129
- 'lib/ruby-enum/enum.rb'
2230

2331
# Offense count: 4
32+
# Configuration parameters: AllowedConstants.
2433
Style/Documentation:
2534
Exclude:
2635
- 'spec/**/*'
@@ -29,9 +38,9 @@ Style/Documentation:
2938
- 'lib/ruby-enum/errors/base.rb'
3039
- 'lib/ruby-enum/errors/uninitialized_constant_error.rb'
3140

32-
# Offense count: 10
33-
# Cop supports --auto-correct.
34-
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
41+
# Offense count: 1
42+
# This cop supports safe autocorrection (--autocorrect).
43+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
3544
# URISchemes: http, https
3645
Layout/LineLength:
3746
Max: 148

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### 0.9.1 (Next)
22

3+
* [#39](https://github.com/dblock/ruby-enum/pull/39): Require Ruby >= 2.7 - [@petergoldstein](https://github.com/petergoldstein).
34
* [#38](https://github.com/dblock/ruby-enum/pull/38): Ensure Ruby >= 2.3 - [@ojab](https://github.com/ojab).
45
* Your contribution here.
56

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ group :development, :test do
1111
gem 'danger-changelog', '0.6.1'
1212
gem 'danger-toc', '0.2.0'
1313
gem 'rspec', '~> 3.0'
14-
gem 'rubocop', '0.80.1'
14+
gem 'rubocop', '~> 1.0'
1515
end
1616

1717
group :test do

lib/ruby-enum/enum.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ def each_key(&_block)
144144
end
145145

146146
def to_h
147-
Hash[@_enum_hash.map do |key, enum|
148-
[key, enum.value]
149-
end]
147+
@_enum_hash.transform_values(&:value)
150148
end
151149

152150
private

lib/ruby-enum/errors/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def compose_message(key, attributes = {})
2828

2929
private
3030

31-
BASE_KEY = 'ruby.enum.errors.messages' #:nodoc:
31+
BASE_KEY = 'ruby.enum.errors.messages' # :nodoc:
3232

3333
# Given the key of the specific error and the options hash, translate the
3434
# message.

0 commit comments

Comments
 (0)