Skip to content

Commit ebec414

Browse files
committed
modernize
- raise required ruby version to 3.1 - update rubocop, simplify config, and apply cops
1 parent 88f2e3d commit ebec414

36 files changed

+1898
-1971
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
rubocop:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
- name: Set up Ruby
14+
uses: ruby/setup-ruby@v1
15+
with:
16+
ruby-version: 3.1
17+
bundler-cache: true
18+
- name: Run rubocop
19+
run: bin/rubocop
20+
rspec:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
ruby-version: [3.1, 3.2, 3.3, 3.4]
25+
steps:
26+
- uses: actions/checkout@v6
27+
- name: Set up Ruby
28+
uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: ${{ matrix.ruby-version}}
31+
bundler-cache: true
32+
- name: Run rspec
33+
run: bin/rspec

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/.bundle/
2-
/.byebug_history
32
/.ruby-version
43
/.yardoc
54
/pkg/*.gem

.rubocop.yml

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,27 @@
1-
require:
1+
inherit_gem:
2+
rubocop-inst:
3+
- rubocop.yml
4+
- rubocop-rspec.yml
5+
6+
plugins:
27
- rubocop-rake
3-
- rubocop-rspec
48

59
AllCops:
6-
TargetRubyVersion: 2.5
7-
NewCops: enable
8-
Exclude:
9-
- 'bin/*'
10+
TargetRubyVersion: 3.1
1011

11-
Layout/SpaceAroundOperators:
12-
EnforcedStyleForExponentOperator: space
13-
Lint/InheritException:
14-
Enabled: false
1512
Naming/FileName:
1613
Exclude: [ lib/mqtt-ccutrer.rb ]
14+
1715
RSpec/ContextWording:
18-
Enabled: false # TODO: enable
19-
RSpec/DescribeClass:
20-
Enabled: false
21-
RSpec/DescribedClass:
22-
Enabled: false
23-
RSpec/ExampleLength:
24-
Enabled: false
25-
RSpec/InstanceVariable:
26-
Enabled: false # TODO: enable
27-
RSpec/MessageSpies:
28-
Enabled: false
29-
RSpec/MultipleExpectations:
30-
Enabled: false
31-
RSpec/NestedGroups:
32-
Enabled: false
33-
RSpec/RepeatedDescription:
34-
Enabled: false # TODO: enable
35-
RSpec/StubbedMock:
36-
Enabled: false
37-
RSpec/VerifiedDoubles:
38-
Enabled: false
16+
Prefixes:
17+
- that
18+
- when
19+
- with
20+
- without
21+
3922
Style/Documentation:
4023
Enabled: false
4124
Style/FormatString:
4225
Enabled: false
4326
Style/AccessorGrouping:
4427
Enabled: false
45-
Style/NumericPredicate:
46-
Enabled: false
47-
Style/RescueStandardError:
48-
EnforcedStyle: implicit
49-
Style/StringConcatenation:
50-
Enabled: false
51-
52-
Metrics:
53-
Enabled: false

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.yardopts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
--no-private
2-
--exclude lib/mqtt/patches/
32
-
43
README.md
54
NEWS.md

Gemfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44

5-
# Gem's dependencies are specified in mqtt.gemspec
65
gemspec
6+
7+
gem "debug", "~> 1.11"
8+
gem "rake", "~> 13.3"
9+
gem "rspec", "~> 3.13"
10+
gem "rubocop-inst", "~> 1.2"
11+
gem "rubocop-rake", "~> 0.7"
12+
gem "rubocop-rspec", "~> 3.9"
13+
gem "simplecov", "~> 0.22"
14+
gem "yard", "~> 0.9"

Gemfile.lock

Lines changed: 92 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,71 +7,113 @@ PATH
77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
ast (2.4.2)
11-
byebug (11.1.3)
12-
diff-lcs (1.4.4)
13-
docile (1.3.5)
10+
ast (2.4.3)
11+
cgi (0.5.1)
12+
date (3.5.1)
13+
debug (1.11.1)
14+
irb (~> 1.10)
15+
reline (>= 0.3.8)
16+
diff-lcs (1.6.2)
17+
docile (1.4.1)
18+
erb (4.0.4)
19+
cgi (>= 0.3.3)
20+
io-console (0.8.2)
21+
irb (1.16.0)
22+
pp (>= 0.6.0)
23+
rdoc (>= 4.0.0)
24+
reline (>= 0.4.2)
25+
json (2.18.0)
26+
language_server-protocol (3.17.0.5)
27+
lint_roller (1.1.0)
1428
logger (1.7.0)
15-
parallel (1.20.1)
16-
parser (3.0.0.0)
29+
parallel (1.27.0)
30+
parser (3.3.10.1)
1731
ast (~> 2.4.1)
18-
rainbow (3.0.0)
19-
rake (13.0.3)
20-
regexp_parser (2.0.3)
21-
rexml (3.2.4)
22-
rspec (3.10.0)
23-
rspec-core (~> 3.10.0)
24-
rspec-expectations (~> 3.10.0)
25-
rspec-mocks (~> 3.10.0)
26-
rspec-core (3.10.1)
27-
rspec-support (~> 3.10.0)
28-
rspec-expectations (3.10.1)
32+
racc
33+
pp (0.6.3)
34+
prettyprint
35+
prettyprint (0.2.0)
36+
prism (1.8.0)
37+
psych (5.3.1)
38+
date
39+
stringio
40+
racc (1.8.1)
41+
rainbow (3.1.1)
42+
rake (13.3.1)
43+
rdoc (7.1.0)
44+
erb
45+
psych (>= 4.0.0)
46+
tsort
47+
regexp_parser (2.11.3)
48+
reline (0.6.3)
49+
io-console (~> 0.5)
50+
rspec (3.13.2)
51+
rspec-core (~> 3.13.0)
52+
rspec-expectations (~> 3.13.0)
53+
rspec-mocks (~> 3.13.0)
54+
rspec-core (3.13.6)
55+
rspec-support (~> 3.13.0)
56+
rspec-expectations (3.13.5)
2957
diff-lcs (>= 1.2.0, < 2.0)
30-
rspec-support (~> 3.10.0)
31-
rspec-mocks (3.10.2)
58+
rspec-support (~> 3.13.0)
59+
rspec-mocks (3.13.7)
3260
diff-lcs (>= 1.2.0, < 2.0)
33-
rspec-support (~> 3.10.0)
34-
rspec-support (3.10.2)
35-
rubocop (1.10.0)
61+
rspec-support (~> 3.13.0)
62+
rspec-support (3.13.6)
63+
rubocop (1.82.1)
64+
json (~> 2.3)
65+
language_server-protocol (~> 3.17.0.2)
66+
lint_roller (~> 1.1.0)
3667
parallel (~> 1.10)
37-
parser (>= 3.0.0.0)
68+
parser (>= 3.3.0.2)
3869
rainbow (>= 2.2.2, < 4.0)
39-
regexp_parser (>= 1.8, < 3.0)
40-
rexml
41-
rubocop-ast (>= 1.2.0, < 2.0)
70+
regexp_parser (>= 2.9.3, < 3.0)
71+
rubocop-ast (>= 1.48.0, < 2.0)
4272
ruby-progressbar (~> 1.7)
43-
unicode-display_width (>= 1.4.0, < 3.0)
44-
rubocop-ast (1.4.1)
45-
parser (>= 2.7.1.5)
46-
rubocop-rake (0.5.1)
47-
rubocop
48-
rubocop-rspec (2.2.0)
49-
rubocop (~> 1.0)
50-
rubocop-ast (>= 1.1.0)
51-
ruby-progressbar (1.11.0)
52-
simplecov (0.21.2)
73+
unicode-display_width (>= 2.4.0, < 4.0)
74+
rubocop-ast (1.49.0)
75+
parser (>= 3.3.7.2)
76+
prism (~> 1.7)
77+
rubocop-inst (1.2.2)
78+
rubocop (~> 1.72, >= 1.72.1)
79+
rubocop-performance (~> 1.24)
80+
rubocop-performance (1.26.1)
81+
lint_roller (~> 1.1)
82+
rubocop (>= 1.75.0, < 2.0)
83+
rubocop-ast (>= 1.47.1, < 2.0)
84+
rubocop-rake (0.7.1)
85+
lint_roller (~> 1.1)
86+
rubocop (>= 1.72.1)
87+
rubocop-rspec (3.9.0)
88+
lint_roller (~> 1.1)
89+
rubocop (~> 1.81)
90+
ruby-progressbar (1.13.0)
91+
simplecov (0.22.0)
5392
docile (~> 1.1)
5493
simplecov-html (~> 0.11)
5594
simplecov_json_formatter (~> 0.1)
56-
simplecov-html (0.12.3)
57-
simplecov_json_formatter (0.1.2)
58-
unicode-display_width (2.0.0)
59-
yard (0.9.26)
95+
simplecov-html (0.13.2)
96+
simplecov_json_formatter (0.1.4)
97+
stringio (3.2.0)
98+
tsort (0.2.0)
99+
unicode-display_width (3.2.0)
100+
unicode-emoji (~> 4.1)
101+
unicode-emoji (4.2.0)
102+
yard (0.9.38)
60103

61104
PLATFORMS
62105
ruby
63106

64107
DEPENDENCIES
65-
bundler (>= 1.11.2)
66-
byebug (~> 11.1)
108+
debug (~> 1.11)
67109
mqtt-ccutrer!
68-
rake (>= 10.2.2)
69-
rspec (>= 3.5.0)
70-
rubocop (~> 1.10)
71-
rubocop-rake (~> 0.5)
72-
rubocop-rspec (~> 2.2)
73-
simplecov (>= 0.9.2)
74-
yard (>= 0.9.11)
110+
rake (~> 13.3)
111+
rspec (~> 3.13)
112+
rubocop-inst (~> 1.2)
113+
rubocop-rake (~> 0.7)
114+
rubocop-rspec (~> 3.9)
115+
simplecov (~> 0.22)
116+
yard (~> 0.9)
75117

76118
BUNDLED WITH
77-
4.0.3
119+
2.6.9

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
[![Build Status](https://travis-ci.org/njh/ruby-mqtt.svg)](https://travis-ci.org/ccutrer/ruby-mqtt)
2-
31
ruby-mqtt
42
=========
53

Rakefile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# frozen_string_literal: true
22

3-
require 'yard'
4-
require 'rspec/core/rake_task'
5-
require 'bundler/gem_tasks'
3+
require "bundler/gem_tasks"
4+
require "rspec/core/rake_task"
5+
require "rubocop/rake_task"
6+
require "yard"
67

78
RSpec::Core::RakeTask.new(:spec)
89

910
namespace :spec do
10-
desc 'Run RSpec code examples in specdoc mode'
11+
desc "Run RSpec code examples in specdoc mode"
1112
RSpec::Core::RakeTask.new(:doc) do |t|
1213
t.rspec_opts = %w[--backtrace --colour --format doc]
1314
end
@@ -16,16 +17,12 @@ end
1617
namespace :doc do
1718
YARD::Rake::YardocTask.new
1819

19-
desc 'Generate HTML report specs'
20-
RSpec::Core::RakeTask.new('spec') do |spec|
21-
spec.rspec_opts = ['--format', 'html', '-o', 'doc/spec.html']
20+
desc "Generate HTML report specs"
21+
RSpec::Core::RakeTask.new("spec") do |spec|
22+
spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
2223
end
2324
end
2425

25-
require 'rubocop/rake_task'
26-
27-
RuboCop::RakeTask.new do |task|
28-
task.options = ['-DS']
29-
end
26+
RuboCop::RakeTask.new
3027

3128
task default: %i[spec rubocop]

0 commit comments

Comments
 (0)