Skip to content

Commit

Permalink
Layout/SpaceAroundEqualsInParameterDefault no_space
Browse files Browse the repository at this point in the history
  • Loading branch information
nschonni committed Feb 27, 2023
1 parent 2ec2136 commit 8dca179
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ AllCops:
Exclude:
- 'examples/sax_ractor.rb' # uses newer syntax than 2.5 supports

Layout/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space

Naming/MethodName:
EnforcedStyle: snake_case
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion contrib/sax_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def end_element(key)
end
end

def start_element(key, attrs = [])
def start_element(key, attrs=[])
@stack << @node = {}
attrs.each do |attr|
key, val = *attr
Expand Down
2 changes: 1 addition & 1 deletion lib/ox/bag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Bag
#
# Ox::Bag.new(:@x => 42, :@y => 57)
#
def initialize(args = {})
def initialize(args={})
args.each do |k, v|
self.instance_variable_set(k, v)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ox/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Document < Element
# - _:version_ [String] version, typically '1.0' or '1.1'
# - _:encoding_ [String] encoding for the document, currently included but ignored
# - _:standalone_ [String] indicates the document is standalone
def initialize(prolog = {})
def initialize(prolog={})
super(nil)
@attributes = {}
@attributes[:version] = prolog[:version] unless prolog[:version].nil?
Expand Down
4 changes: 2 additions & 2 deletions lib/ox/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def attr_match(cond)
# matching name will be yielded to. If the cond is a Hash then the
# keys-value pairs in the cond must match the child attribute values with
# the same keys. Any other cond type will yield to nothing.
def each(cond = nil, &block)
def each(cond=nil, &block)
build_enumerator(cond).each(&block)
end

Expand Down Expand Up @@ -233,7 +233,7 @@ def method_missing(id, *args, &block)
# - +id+ [String|Symbol] identifer of the attribute or method
# - +ignored+ inc_all [Boolean]
# *return* true if the element has a member that matches the provided name.
def respond_to?(id, inc_all = false)
def respond_to?(id, inc_all=false)
return true if super

id_str = id.to_s
Expand Down
2 changes: 1 addition & 1 deletion test/ox/change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Change
attr_accessor :user
attr_accessor :comment

def initialize(comment = nil, time = nil, user = nil)
def initialize(comment=nil, time=nil, user=nil)
@user = user || ENV['USER']
@time = time || Time.now
@comment = comment
Expand Down
2 changes: 1 addition & 1 deletion test/ox/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def initialize(title)
@change_history = []
end

def add_change(comment, time = nil, user = nil)
def add_change(comment, time=nil, user=nil)
@change_history << Change.new(comment, time, user)
end
end # Doc
Expand Down
2 changes: 1 addition & 1 deletion test/ox/oval.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Test
module Ox
class Oval < Shape
def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
super
end
end # Oval
Expand Down
2 changes: 1 addition & 1 deletion test/ox/rect.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Test
module Ox
class Rect < Shape
def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
super
end
end # Rect
Expand Down
2 changes: 1 addition & 1 deletion test/ox/shape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Shape
attr_accessor :color
attr_accessor :border, :border_color

def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
@bounds = [[left, top], [left + wide, top + high]]
@color = color
@border = 1
Expand Down
2 changes: 1 addition & 1 deletion test/ox/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Text < Shape
attr_accessor :just
attr_accessor :text_color

def initialize(text, left, top, wide, high, color = nil)
def initialize(text, left, top, wide, high, color=nil)
super(left, top, wide, high, color)
@text = text
@font = 'helvetica'
Expand Down
2 changes: 1 addition & 1 deletion test/perf_mars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Ox
class Wrap
attr_accessor :values

def initialize(v = [])
def initialize(v=[])
@values = v
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/perf_sax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def warning(message); puts message; end
end

class NoAllSax < NoSax
def start_element(name, attrs = []); end
def start_element(name, attrs=[]); end
def characters(text); end
def cdata_block(string); end
def comment(string); end
Expand Down
2 changes: 1 addition & 1 deletion test/sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

require 'sample/doc'

def sample_doc(size = 3)
def sample_doc(size=3)
colors = [:black, :gray, :white, :red, :blue, :yellow, :green, :purple, :orange]

d = ::Sample::Doc.new('Sample')
Expand Down
2 changes: 1 addition & 1 deletion test/sample/change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Change
attr_accessor :user
attr_accessor :comment

def initialize(comment = nil, time = nil, user = nil)
def initialize(comment=nil, time=nil, user=nil)
@user = user || ENV['USER']
@time = time || Time.now
@comment = comment
Expand Down
2 changes: 1 addition & 1 deletion test/sample/doc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def initialize(title)
@change_history = []
end

def add_change(comment, time = nil, user = nil)
def add_change(comment, time=nil, user=nil)
@change_history << Change.new(comment, time, user)
end
end # Doc
Expand Down
2 changes: 1 addition & 1 deletion test/sample/oval.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Sample
class Oval < Shape
def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
super
end
end # Oval
Expand Down
2 changes: 1 addition & 1 deletion test/sample/rect.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Sample
class Rect < Shape
def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
super
end
end # Rect
Expand Down
2 changes: 1 addition & 1 deletion test/sample/shape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Shape
attr_accessor :color
attr_accessor :border, :border_color

def initialize(left, top, wide, high, color = nil)
def initialize(left, top, wide, high, color=nil)
@bounds = [[left, top], [left + wide, top + high]]
@color = color
@border = 1
Expand Down
2 changes: 1 addition & 1 deletion test/sample/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Text < Shape
attr_accessor :just
attr_accessor :text_color

def initialize(text, left, top, wide, high, color = nil)
def initialize(text, left, top, wide, high, color=nil)
super(left, top, wide, high, color)
@text = text
@font = 'helvetica'
Expand Down
2 changes: 1 addition & 1 deletion test/sax/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module SaxTestHelpers
# [:end_element, :top]
# ], AllSax, :convert_special => true, :smart => true)
#
def parse_compare(xml, expected, handler_class = AllSax, opts = {}, handler_attr = :calls)
def parse_compare(xml, expected, handler_class=AllSax, opts={}, handler_attr=:calls)
handler = handler_class.new()
input = StringIO.new(xml)
options = {
Expand Down
6 changes: 3 additions & 3 deletions test/sax/smart_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class SaxSmartTest < ::Test::Unit::TestCase
}

# Make the :smart => true option the default one
def smart_parse_compare(xml, expected, handler = AllSax, opts = {}, handler_attr = :calls)
def smart_parse_compare(xml, expected, handler=AllSax, opts={}, handler_attr=:calls)
parse_compare(xml, expected, handler, opts.merge(:smart => true, :skip => :skip_white), handler_attr)
end
end
Expand All @@ -157,7 +157,7 @@ def parents_of(el)
NORMALELEMENTS[el]["parents"] || ["body"]
end

def ancestry_of(el, parent = nil)
def ancestry_of(el, parent=nil)
p = parent || parents_of(el)[0]
[el] + (p ? ancestry_of(p) : [])
end
Expand Down Expand Up @@ -593,7 +593,7 @@ def test_html_bad_table
[:end_element, :html]])
end

def html_parse_compare(xml, expected, opts = {})
def html_parse_compare(xml, expected, opts={})
handler = AllSax.new()
input = StringIO.new(xml)
options = {
Expand Down
2 changes: 1 addition & 1 deletion test/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1909,7 +1909,7 @@ def test_encoding_ascii
assert_equal(Encoding::UTF_8, text.encoding)
end

def dump_and_load(obj, trace = false, circular = false)
def dump_and_load(obj, trace=false, circular=false)
xml = Ox.dump(obj, :indent => $indent, :circular => circular)
puts xml if trace
loaded = Ox.load(xml, :trace => (trace ? 2 : 0))
Expand Down
2 changes: 1 addition & 1 deletion test/weather/wnosax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def initialize(as_time)
@cell = 0
end

def start_element(name, attrs = [])
def start_element(name, attrs=[])
case name
when 'Cell'
@cell += 1
Expand Down

0 comments on commit 8dca179

Please sign in to comment.