Skip to content

Commit

Permalink
Fix rubocop linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Uelb committed Mar 21, 2024
1 parent b54fe79 commit 18d1e1d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ gemspec

group :development do
gem 'rubocop', '~> 1.47', require: false
gem 'rake-compiler', '>= 1.2', '< 2.0'

Check failure on line 7 in Gemfile

View workflow job for this annotation

GitHub Actions / Formatting Check

[Correctable] Bundler/OrderedGems: Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem rake-compiler should appear before rubocop.
end
4 changes: 2 additions & 2 deletions contrib/sax_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}.strip.gsub(/>\s+</, '><')

class OxHandler < Ox::Sax
attr :root
attr_reader :root

def initialize
super
Expand Down Expand Up @@ -70,7 +70,7 @@ def text(val)
end

class NokogiriHandler < Nokogiri::XML::SAX::Document
attr :root
attr_reader :root

def characters(val)
(@node['__content__'] ||= '') << val
Expand Down
2 changes: 0 additions & 2 deletions ox.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@ serialization. }

s.required_ruby_version = '>= 2.7.0'

s.add_development_dependency 'rake-compiler', '>= 1.2', '< 2.0'

s.metadata['rubygems_mfa_required'] = 'true'
end
2 changes: 1 addition & 1 deletion test/perf_mars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def initialize(v=[])
data[:Fixnum].values << ((i - 10) * 101)
data[:Float].values << ((i.to_f - 10.7) * 30.5)
data[:String].values << "String #{i}"
data[:Symbol].values << "Symbol#{i}".to_sym
data[:Symbol].values << :"Symbol#{i}"
data[:Time].values << (Time.now + i)
data[:Array].values << []
data[:Hash].values << {}
Expand Down
8 changes: 4 additions & 4 deletions test/perf_obj.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
puts 'Load Performance'
perf = Perf.new
perf.add('Ox', 'load') { Ox.load($xml, mode: :object) }
perf.add('Oj', 'load') { Oj.load($json) } unless (defined?(Oj).nil? || ox_only)
perf.add('Oj', 'load') { Oj.load($json) } unless defined?(Oj).nil? || ox_only
perf.add('Marshal', 'load') { Marshal.load($mars) } unless ox_only
perf.run($iter)
end
Expand All @@ -100,7 +100,7 @@
puts 'Dump Performance'
perf = Perf.new
perf.add('Ox', 'dump') { Ox.dump($obj, indent: $indent, circular: $circular) }
perf.add('Oj', 'dump') { Oj.dump($obj) } unless (defined?(Oj).nil? || ox_only)
perf.add('Oj', 'dump') { Oj.dump($obj) } unless defined?(Oj).nil? || ox_only
perf.add('Marshal', 'dump') { Marshal.dump($obj) } unless ox_only
perf.run($iter)
end
Expand All @@ -110,7 +110,7 @@
puts 'Read from file Performance'
perf = Perf.new
perf.add('Ox', 'load_file') { Ox.load_file('sample.xml', mode: :object) }
perf.add('Oj', 'load') { Oj.load_file('sample.json') } unless (defined?(Oj).nil? || ox_only)
perf.add('Oj', 'load') { Oj.load_file('sample.json') } unless defined?(Oj).nil? || ox_only
perf.add('Marshal', 'load') { Marshal.load(File.new('sample.marshal')) } unless ox_only
perf.run($iter)
end
Expand All @@ -120,7 +120,7 @@
puts 'Write to file Performance'
perf = Perf.new
perf.add('Ox', 'to_file') { Ox.to_file('sample.xml', $obj, indent: $indent, circular: $circular) }
perf.add('Oj', 'to_file') { Oj.to_file('sample.json', $obj) } unless (defined?(Oj).nil? || ox_only)
perf.add('Oj', 'to_file') { Oj.to_file('sample.json', $obj) } unless defined?(Oj).nil? || ox_only
perf.add('Marshal', 'dump') { Marshal.dump($obj, File.new('sample.marshal', 'w')) } unless ox_only
perf.run($iter)
end
7 changes: 3 additions & 4 deletions test/sax/sax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1436,11 +1436,10 @@ def test_sax_html_attr
[:start_element, :html],
[:attr, :lang, 'en'],
[:start_element, :head],
[:attr, :url, "http://ohler.com?x=2"],
[:text, " "],
[:attr, :url, 'http://ohler.com?x=2'],
[:text, ' '],
[:end_element, :head],
[:end_element, :html],
[:end_element, :html]
], handler.calls)
end

end
2 changes: 1 addition & 1 deletion test/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ def test_full_encoding_mode_hash
<いち name="ピーター" つま="まきえ">ピーター</いち>
}
obj = Ox.load(xml, mode: :hash)
assert_equal(obj, {いち: [{name: "ピーター", つま: "まきえ"}, "ピーター"]})
assert_equal(obj, { :いち => [{ :name => 'ピーター', :つ => 'まきえ' }, 'ピーター'] })
end

def test_obj_encoding
Expand Down

0 comments on commit 18d1e1d

Please sign in to comment.