Skip to content

Commit 5ce2dba

Browse files
authored
Merge pull request #182 from premailer/grosser/eol
remove eol rubies
2 parents 2ef7dca + f60752a commit 5ce2dba

File tree

10 files changed

+78
-54
lines changed

10 files changed

+78
-54
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'jruby']
15+
ruby-version: ['3.3', '3.4', 'jruby']
1616

1717
steps:
1818
- uses: actions/checkout@v4
@@ -35,7 +35,7 @@ jobs:
3535

3636
- uses: ruby/setup-ruby@v1
3737
with:
38-
ruby-version: '3.0' # lowest supported Ruby version
38+
ruby-version: '3.3' # lowest supported Ruby version
3939
bundler-cache: true
4040

4141
- run: bundle exec rake rubocop

.rubocop.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require:
33
- rubocop-rake
44

55
AllCops:
6-
TargetRubyVersion: 3.0 # lowest supported version
6+
TargetRubyVersion: 3.3 # lowest supported version
77
NewCops: enable
88

99
Layout/ArgumentAlignment:
@@ -79,3 +79,12 @@ Style/WordArray:
7979

8080
Style/SymbolArray:
8181
EnforcedStyle: brackets
82+
83+
Style/HashSyntax:
84+
EnforcedShorthandSyntax: never
85+
86+
Naming/BlockForwarding:
87+
EnforcedStyle: explicit
88+
89+
Style/CollectionQuerying:
90+
Enabled: false

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ gem 'benchmark-ips'
1010
gem 'bump'
1111
gem 'maxitest'
1212
gem 'memory_profiler'
13+
gem 'mocha'
14+
gem 'ostruct'
1315
gem 'rake'
14-
gem 'rubocop'
16+
gem 'rubocop', '~> 1.84.2' # locked down so we don't get accidental new cops
1517
gem 'rubocop-performance'
1618
gem 'rubocop-rake'
1719
gem 'webrick'

Gemfile.lock

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,50 +7,61 @@ PATH
77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
addressable (2.8.6)
11-
public_suffix (>= 2.0.2, < 6.0)
12-
ast (2.4.2)
13-
benchmark-ips (2.13.0)
10+
addressable (2.8.8)
11+
public_suffix (>= 2.0.2, < 8.0)
12+
ast (2.4.3)
13+
benchmark-ips (2.14.0)
1414
bump (0.10.0)
15-
json (2.7.2)
16-
json (2.7.2-java)
17-
language_server-protocol (3.17.0.3)
18-
maxitest (4.5.0)
19-
minitest (>= 5.0.0, < 5.19.0)
20-
memory_profiler (1.0.1)
21-
minitest (5.18.1)
22-
parallel (1.24.0)
23-
parser (3.3.0.5)
15+
json (2.18.1)
16+
json (2.18.1-java)
17+
language_server-protocol (3.17.0.5)
18+
lint_roller (1.1.0)
19+
maxitest (7.1.1)
20+
minitest (>= 6.0.0, < 6.1.0)
21+
memory_profiler (1.1.0)
22+
minitest (6.0.1)
23+
prism (~> 1.5)
24+
mocha (3.0.2)
25+
ruby2_keywords (>= 0.0.5)
26+
ostruct (0.6.3)
27+
parallel (1.27.0)
28+
parser (3.3.10.2)
2429
ast (~> 2.4.1)
2530
racc
26-
public_suffix (5.0.5)
27-
racc (1.7.3)
28-
racc (1.7.3-java)
31+
prism (1.9.0)
32+
public_suffix (7.0.2)
33+
racc (1.8.1)
34+
racc (1.8.1-java)
2935
rainbow (3.1.1)
30-
rake (13.2.1)
31-
regexp_parser (2.9.0)
32-
rexml (3.2.6)
33-
rubocop (1.62.1)
36+
rake (13.3.1)
37+
regexp_parser (2.11.3)
38+
rubocop (1.84.2)
3439
json (~> 2.3)
35-
language_server-protocol (>= 3.17.0)
40+
language_server-protocol (~> 3.17.0.2)
41+
lint_roller (~> 1.1.0)
3642
parallel (~> 1.10)
3743
parser (>= 3.3.0.2)
3844
rainbow (>= 2.2.2, < 4.0)
39-
regexp_parser (>= 1.8, < 3.0)
40-
rexml (>= 3.2.5, < 4.0)
41-
rubocop-ast (>= 1.31.1, < 2.0)
45+
regexp_parser (>= 2.9.3, < 3.0)
46+
rubocop-ast (>= 1.49.0, < 2.0)
4247
ruby-progressbar (~> 1.7)
43-
unicode-display_width (>= 2.4.0, < 3.0)
44-
rubocop-ast (1.31.2)
45-
parser (>= 3.3.0.4)
46-
rubocop-performance (1.23.0)
47-
rubocop (>= 1.48.1, < 2.0)
48-
rubocop-ast (>= 1.31.1, < 2.0)
49-
rubocop-rake (0.6.0)
50-
rubocop (~> 1.0)
48+
unicode-display_width (>= 2.4.0, < 4.0)
49+
rubocop-ast (1.49.0)
50+
parser (>= 3.3.7.2)
51+
prism (~> 1.7)
52+
rubocop-performance (1.26.1)
53+
lint_roller (~> 1.1)
54+
rubocop (>= 1.75.0, < 2.0)
55+
rubocop-ast (>= 1.47.1, < 2.0)
56+
rubocop-rake (0.7.1)
57+
lint_roller (~> 1.1)
58+
rubocop (>= 1.72.1)
5159
ruby-progressbar (1.13.0)
52-
unicode-display_width (2.5.0)
53-
webrick (1.8.1)
60+
ruby2_keywords (0.0.5)
61+
unicode-display_width (3.2.0)
62+
unicode-emoji (~> 4.1)
63+
unicode-emoji (4.2.0)
64+
webrick (1.9.2)
5465

5566
PLATFORMS
5667
java
@@ -62,8 +73,10 @@ DEPENDENCIES
6273
css_parser!
6374
maxitest
6475
memory_profiler
76+
mocha
77+
ostruct
6578
rake
66-
rubocop
79+
rubocop (~> 1.84.2)
6780
rubocop-performance
6881
rubocop-rake
6982
webrick

css_parser.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Gem::Specification.new name, CssParser::VERSION do |s|
1111
s.author = 'Alex Dunae'
1212
s.files = Dir.glob('lib/**/*') + ['MIT-LICENSE']
1313
s.license = 'MIT'
14-
s.required_ruby_version = '>= 3.0'
14+
s.required_ruby_version = '>= 3.3'
1515

1616
s.metadata['changelog_uri'] = 'https://github.com/premailer/css_parser/blob/master/CHANGELOG.md'
1717
s.metadata['source_code_uri'] = 'https://github.com/premailer/css_parser'
1818
s.metadata['bug_tracker_uri'] = 'https://github.com/premailer/css_parser/issues'
1919
s.metadata['rubygems_mfa_required'] = 'true'
2020

21-
s.add_runtime_dependency 'addressable'
21+
s.add_dependency 'addressable'
2222
end

lib/css_parser/parser.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def add_block!(block, options = {})
143143
media_types = [:all]
144144
end
145145

146-
next unless options[:only_media_types].include?(:all) or media_types.empty? or !(media_types & options[:only_media_types]).empty?
146+
next unless options[:only_media_types].include?(:all) or media_types.empty? or media_types.intersect?(options[:only_media_types])
147147

148148
import_path = import_rule[0].to_s.gsub(/['"]*/, '').strip
149149

@@ -568,7 +568,8 @@ def load_string!(src, options = {}, deprecated = nil)
568568
#
569569
# Raises a CircularReferenceError exception if io_exceptions are on,
570570
# otherwise returns true/false.
571-
def circular_reference_check(path)
571+
# TODO: fix rubocop
572+
def circular_reference_check(path) # rubocop:disable Naming/PredicateMethod
572573
path = path.to_s
573574
if @loaded_uris.include?(path)
574575
raise CircularReferenceError, "can't load #{path} more than once" if @options[:io_exceptions]

test/rule_set/test_declarations.rb

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

33
require_relative '../test_helper'
4-
require 'minitest/spec'
54

65
class RuleSetDeclarationsTest < Minitest::Test
76
describe '.new' do
@@ -382,14 +381,12 @@ class RuleSetDeclarationsTest < Minitest::Test
382381

383382
declarations = CssParser::RuleSet::Declarations.new({foo: foo_value, bar: bar_value, baz: baz_value})
384383

385-
mock = Minitest::Mock.new
386-
mock.expect :call, true, ['foo', foo_value]
387-
mock.expect :call, true, ['bar', bar_value]
388-
mock.expect :call, true, ['baz', baz_value]
384+
mock = stub("Fake")
385+
mock.expects(:call).with('foo', foo_value).returns(true)
386+
mock.expects(:call).with('bar', bar_value).returns(true)
387+
mock.expects(:call).with('baz', baz_value).returns(true)
389388

390389
declarations.each { |name, value| mock.call(name, value) }
391-
392-
assert_mock mock
393390
end
394391
end
395392
end

test/test_css_parser_misc.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ def test_enumerator_nonempty
227227
end
228228
end
229229

230-
def with_value_exception(&block)
230+
def with_value_exception
231231
# Raise synthetic exception to test error handling because there is no known way to cause it naturally
232-
CssParser::RuleSet::Declarations::Value.stub :new, -> { raise ArgumentError.new, 'stub' }, &block
232+
CssParser::RuleSet::Declarations::Value.stubs(:new).raises(ArgumentError.new('stub'))
233+
yield # TODO: do not pass a block instead
233234
end
234235

235236
def test_catching_argument_exceptions_for_add_rule

test/test_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
require 'bundler/setup'
44
require 'maxitest/autorun'
5+
require 'mocha/minitest'
6+
require 'ostruct'
57
require 'net/http'
68
require 'webrick'
79
require 'css_parser'

test/test_rule_set.rb

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

33
require_relative 'test_helper'
4-
require "set"
54

65
# Test cases for parsing CSS blocks
76
class RuleSetTests < Minitest::Test
@@ -81,7 +80,7 @@ def test_each_declaration_containing_semicolons
8180
def test_each_declaration_with_newlines
8281
expected = Set[
8382
{property: 'background-image', value: 'url(foo;bar)', is_important: false},
84-
{property: 'font-weight', value: 'bold', is_important: true},
83+
{property: 'font-weight', value: 'bold', is_important: true}
8584
]
8685
rs = RuleSet.new(block: "background-image\n:\nurl(foo;bar);\n\n\n\n\n;;font-weight\n\n\n:bold\n\n\n!important")
8786
actual = Set.new

0 commit comments

Comments
 (0)