From ea8964ef3588df28324e521c98b5df6ad42c0609 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Mon, 31 Oct 2022 16:25:56 +1000 Subject: [PATCH] ruby: standardize whitespace --- build_config/IntelGalileo.rb | 2 +- build_config/cross-mingw-winetest.rb | 12 ++++++------ build_config/helpers/wine_runner.rb | 2 +- lib/mruby/build/load_gems.rb | 12 ++++++------ mrbgems/mruby-array-ext/mrblib/array.rb | 16 ++++++++-------- mrbgems/mruby-cmath/test/cmath.rb | 2 +- mrbgems/mruby-enum-ext/mrblib/enum.rb | 18 +++++++++--------- mrbgems/mruby-enumerator/mrblib/enumerator.rb | 16 ++++++++-------- mrbgems/mruby-fiber/test/fiber.rb | 4 ++-- mrbgems/mruby-hash-ext/mrblib/hash.rb | 8 ++++---- mrbgems/mruby-hash-ext/test/hash.rb | 2 +- mrbgems/mruby-io/test/file.rb | 2 +- mrbgems/mruby-metaprog/test/metaprog.rb | 6 +++--- mrbgems/mruby-string-ext/mrblib/string.rb | 4 ++-- mrblib/array.rb | 4 ++-- mrblib/hash.rb | 2 +- test/assert.rb | 4 ++-- test/t/integer.rb | 2 +- test/t/lang.rb | 2 +- test/t/module.rb | 6 +++--- 20 files changed, 63 insertions(+), 63 deletions(-) diff --git a/build_config/IntelGalileo.rb b/build_config/IntelGalileo.rb index f1f39e5dc..2b5c05f28 100644 --- a/build_config/IntelGalileo.rb +++ b/build_config/IntelGalileo.rb @@ -12,7 +12,7 @@ MRuby::CrossBuild.new("Galileo") do |conf| #ARDUINO_GALILEO_PATH = '/opt/arduino' GALILEO_BIN_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i386-pokysdk-darwin/usr/bin/i586-poky-linux-uclibc" - GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc" + GALILEO_SYSROOT = "#{GALILEO_ARDUINO_PATH}/hardware/tools/x86/i586-poky-linux-uclibc" GALILEO_X86_PATH = "#{GALILEO_ARDUINO_PATH}/hardware/arduino/x86" diff --git a/build_config/cross-mingw-winetest.rb b/build_config/cross-mingw-winetest.rb index c275b182c..c671b70b6 100644 --- a/build_config/cross-mingw-winetest.rb +++ b/build_config/cross-mingw-winetest.rb @@ -16,11 +16,11 @@ # # 4. Confirm that drive 'z:' is mapped to your root filesystem. # (This is supposed to be a default but it helps to -# double-check.) To confirm, run: +# double-check.) To confirm, run: # # wine cmd /c dir 'z:\\' # -# This should give you a DOS-style equivalent of 'ls /'. If not, +# This should give you a DOS-style equivalent of 'ls /'. If not, # you'll need to fix that with winecfg or by adding a symlink to # '~/.wine/dosdevices'. # @@ -40,8 +40,8 @@ # # 1. This works by using a helper script that rewrites test output # to make it look *nix-like and then handing it back to the test -# cases. Some of the existing tests were (slightly) modified to -# make this easier but only for the 'full-core' gembox. Other +# cases. Some of the existing tests were (slightly) modified to +# make this easier but only for the 'full-core' gembox. Other # gems' bintests may or may not work with the helper script and # may or may not be fixable by extending the script. # @@ -50,11 +50,11 @@ # # 3. This script assumes you are running it on a *nix-style OS. # -# 4. I recommend building 64-bit targets only. Building a 32-bit +# 4. I recommend building 64-bit targets only. Building a 32-bit # Windows binary with i686-w64-mingw32 seems to work (at least, # it did for me) but the resulting executable failed a number of # unit tests due to small errors in some floating-point -# operations. It's unclear if this indicates more serious problems. +# operations. It's unclear if this indicates more serious problems. # diff --git a/build_config/helpers/wine_runner.rb b/build_config/helpers/wine_runner.rb index 9a7eb46b0..17b90f935 100755 --- a/build_config/helpers/wine_runner.rb +++ b/build_config/helpers/wine_runner.rb @@ -46,7 +46,7 @@ def main end # For simplicity, just read all of stdin into memory and pass that - # as an argument when invoking wine. (Skipped if STDIN was not + # as an argument when invoking wine. (Skipped if STDIN was not # redirected.) if !STDIN.tty? input = STDIN.read diff --git a/lib/mruby/build/load_gems.rb b/lib/mruby/build/load_gems.rb index 3de929bba..4142881ab 100644 --- a/lib/mruby/build/load_gems.rb +++ b/lib/mruby/build/load_gems.rb @@ -59,7 +59,7 @@ module MRuby @gemdir = gemdir # Working copy of the gem @path = path # Path to gem relative to checkout - @repo = repo # Remote gem repo + @repo = repo # Remote gem repo @branch = branch # Branch to check out @commit = commit # Commit-id to use @@ -194,7 +194,7 @@ module MRuby gem_src = File.expand_path(gem_src, File.dirname(MRuby::GemBox.path)) else # Otherwise, we use the path to the build_config.rb file that - # requested this gem. This path was extracted earlier and + # requested this gem. This path was extracted earlier and # stored in @build_config_dir via the second argument of # 'initialize'. root_dir = @build_config_dir @@ -308,10 +308,10 @@ module MRuby end - # Test if this repo can be skipped. This will happen if it's + # Test if this repo can be skipped. This will happen if it's # already in @gem_checkouts and EITHER it is identical (same # url, branch, commit-ID and subdirectory path) as the current - # checkout OR its "canonical" flag is true. If it's in + # checkout OR its "canonical" flag is true. If it's in # @gem_checkouts and neither of these conditions is true, that's # a fatal error; it means there are multiple incompatible # versions of this gem to be checked out into this directory. @@ -340,14 +340,14 @@ module MRuby return true end - # Otherwise, we have a checkout conflict. This is an error. + # Otherwise, we have a checkout conflict. This is an error. fail "Conflicting gem definitions for '#{repo_dir}':\n" + " #{candidate}\n" + " #{prev}\n" end - # Retrieve a git repo if it's not present. Return + # Retrieve a git repo if it's not present. Return # [path_to_checkout, did_clone] def git_clone_dependency(url, repo_dir, commit, branch) return if diff --git a/mrbgems/mruby-array-ext/mrblib/array.rb b/mrbgems/mruby-array-ext/mrblib/array.rb index 1722a3631..d493a0651 100644 --- a/mrbgems/mruby-array-ext/mrblib/array.rb +++ b/mrbgems/mruby-array-ext/mrblib/array.rb @@ -239,7 +239,7 @@ class Array # # Returns a new array that is a one-dimensional flattening of this # array (recursively). That is, for every element that is an array, - # extract its elements into the new array. If the optional + # extract its elements into the new array. If the optional # level argument determines the level of recursion to flatten. # # s = [ 1, 2, 3 ] #=> [1, 2, 3] @@ -262,7 +262,7 @@ class Array # # Flattens +self+ in place. # Returns nil if no modifications were made (i.e., - # ary contains no subarrays.) If the optional level + # ary contains no subarrays.) If the optional level # argument determines the level of recursion to flatten. # # a = [ 1, 2, [3, [4, 5] ] ] @@ -313,7 +313,7 @@ class Array # ary.fetch(index) { |index| block } -> obj # # Tries to return the element at position +index+, but throws an IndexError - # exception if the referenced +index+ lies outside of the array bounds. This + # exception if the referenced +index+ lies outside of the array bounds. This # error can be prevented by supplying a second argument, which will act as a # +default+ value. # @@ -539,7 +539,7 @@ class Array # the given condition in O(log n) where n is the size of the array. # # You can use this method in two use cases: a find-minimum mode and - # a find-any mode. In either case, the elements of the array must be + # a find-any mode. In either case, the elements of the array must be # monotone (or sorted) with respect to the block. # # In find-minimum mode (this is a good choice for typical use case), @@ -551,7 +551,7 @@ class Array # - the block returns true for any element whose index is greater # than or equal to i. # - # This method returns the i-th element. If i is equal to ary.size, + # This method returns the i-th element. If i is equal to ary.size, # it returns nil. # # ary = [0, 4, 7, 10, 12] @@ -570,7 +570,7 @@ class Array # j <= k < ary.size. # # Under this condition, this method returns any element whose index - # is within i...j. If i is equal to j (i.e., there is no element + # is within i...j. If i is equal to j (i.e., there is no element # that satisfies the block), this method returns nil. # # ary = [0, 4, 7, 10, 12] @@ -580,7 +580,7 @@ class Array # ary.bsearch {|x| 4 - (x / 2).truncate } #=> nil # # You must not mix the two modes at a time; the block must always - # return either true/false, or always return a number. It is + # return either true/false, or always return a number. It is # undefined which value is actually picked up at each iteration. def bsearch(&block) @@ -707,7 +707,7 @@ class Array # == to +obj+. # # If a block is given instead of an argument, returns the _index_ of the - # first object for which the block returns +true+. Returns +nil+ if no + # first object for which the block returns +true+. Returns +nil+ if no # match is found. # # ISO 15.2.12.5.14 diff --git a/mrbgems/mruby-cmath/test/cmath.rb b/mrbgems/mruby-cmath/test/cmath.rb index ddd0e5106..b48939ca4 100644 --- a/mrbgems/mruby-cmath/test/cmath.rb +++ b/mrbgems/mruby-cmath/test/cmath.rb @@ -27,7 +27,7 @@ end assert('CMath trigonometric_functions') do assert_complex(Math.sinh(2).i, CMath.sin(2i)) - assert_complex(Math.cosh(2)+0i, CMath.cos(2i)) + assert_complex(Math.cosh(2)+0i, CMath.cos(2i)) assert_complex(Math.tanh(2).i, CMath.tan(2i)) assert_complex(Math.sin(2).i, CMath.sinh(2i)) assert_complex(Math.cos(2)+0i, CMath.cosh(2i)) diff --git a/mrbgems/mruby-enum-ext/mrblib/enum.rb b/mrbgems/mruby-enum-ext/mrblib/enum.rb index 3a4416196..2c9e8d3a5 100644 --- a/mrbgems/mruby-enum-ext/mrblib/enum.rb +++ b/mrbgems/mruby-enum-ext/mrblib/enum.rb @@ -244,7 +244,7 @@ module Enumerable # # Returns the number of items in +enum+ through enumeration. # If an argument is given, the number of items in +enum+ that - # are equal to +item+ are counted. If a block is given, it + # are equal to +item+ are counted. If a block is given, it # counts the number of elements yielding a true value. def count(v=NONE, &block) count = 0 @@ -368,7 +368,7 @@ module Enumerable # enum.minmax { |a, b| block } -> [min, max] # # Returns two elements array which contains the minimum and the - # maximum value in the enumerable. The first form assumes all + # maximum value in the enumerable. The first form assumes all # objects implement Comparable; the second uses the # block to return a <=> b. # @@ -647,8 +647,8 @@ module Enumerable # enum.cycle(n=nil) -> an_enumerator # # Calls block for each element of enum repeatedly _n_ - # times or forever if none or +nil+ is given. If a non-positive - # number is given or the collection is empty, does nothing. Returns + # times or forever if none or +nil+ is given. If a non-positive + # number is given or the collection is empty, does nothing. Returns # +nil+ if the loop has finished without getting interrupted. # # Enumerable#cycle saves elements in an internal array so changes @@ -696,7 +696,7 @@ module Enumerable # enum.find_index -> an_enumerator # # Compares each entry in enum with value or passes - # to block. Returns the index for the first for which the + # to block. Returns the index for the first for which the # evaluated value is non-false. If no object matches, returns # nil # @@ -731,10 +731,10 @@ module Enumerable # enum.zip(arg, ...) { |arr| block } -> nil # # Takes one element from enum and merges corresponding - # elements from each args. This generates a sequence of + # elements from each args. This generates a sequence of # n-element arrays, where n is one more than the - # count of arguments. The length of the resulting sequence will be - # enum#size. If the size of any argument is less than + # count of arguments. The length of the resulting sequence will be + # enum#size. If the size of any argument is less than # enum#size, nil values are supplied. If # a block is given, it is invoked for each output array, otherwise # an array of arrays is returned. @@ -844,7 +844,7 @@ module Enumerable # call-seq: # enum.tally -> a_hash # - # Tallys the collection. Returns a hash where the keys are the + # Tallys the collection. Returns a hash where the keys are the # elements and the values are numbers of elements in the collection # that correspond to the key. # diff --git a/mrbgems/mruby-enumerator/mrblib/enumerator.rb b/mrbgems/mruby-enumerator/mrblib/enumerator.rb index 58efceb17..65cddbdac 100644 --- a/mrbgems/mruby-enumerator/mrblib/enumerator.rb +++ b/mrbgems/mruby-enumerator/mrblib/enumerator.rb @@ -36,7 +36,7 @@ # # foo: two # # foo: three # -# This allows you to chain Enumerators together. For example, you +# This allows you to chain Enumerators together. For example, you # can map a list's elements to strings containing the index # and the element as a string via: # @@ -112,7 +112,7 @@ class Enumerator # given object using the given method with the given arguments passed. This # form is left only for internal use. # - # Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum + # Use of this form is discouraged. Use Kernel#enum_for or Kernel#to_enum # instead. def initialize(obj=NONE, meth=:each, *args, **kwd, &block) if block @@ -154,7 +154,7 @@ class Enumerator # e.with_index(offset = 0) # # Iterates the given block for each element with an index, which - # starts from +offset+. If no block is given, returns a new Enumerator + # starts from +offset+. If no block is given, returns a new Enumerator # that includes the index, starting from +offset+ # # +offset+:: the starting index to use @@ -297,7 +297,7 @@ class Enumerator # e.next -> object # # Returns the next object in the enumerator, and move the internal position - # forward. When the position reached at the end, StopIteration is raised. + # forward. When the position reached at the end, StopIteration is raised. # # === Example # @@ -321,7 +321,7 @@ class Enumerator # e.next_values -> array # # Returns the next object as an array in the enumerator, and move the - # internal position forward. When the position reached at the end, + # internal position forward. When the position reached at the end, # StopIteration is raised. # # This method can be used to distinguish yield and yield @@ -405,7 +405,7 @@ class Enumerator # e.peek -> object # # Returns the next object in the enumerator, but doesn't move the internal - # position forward. If the position is already at the end, StopIteration + # position forward. If the position is already at the end, StopIteration # is raised. # # === Example @@ -429,7 +429,7 @@ class Enumerator # e.peek_values -> array # # Returns the next object as an array, similar to Enumerator#next_values, but - # doesn't move the internal position forward. If the position is already at + # doesn't move the internal position forward. If the position is already at # the end, StopIteration is raised. # # === Example @@ -564,7 +564,7 @@ class Enumerator # Enumerator.produce(initial = nil) { |val| } -> enumerator # # Creates an infinite enumerator from any block, just called over and - # over. Result of the previous iteration is passed to the next one. + # over. Result of the previous iteration is passed to the next one. # If +initial+ is provided, it is passed to the first iteration, and # becomes the first element of the enumerator; if it is not provided, # first iteration receives +nil+, and its result becomes first diff --git a/mrbgems/mruby-fiber/test/fiber.rb b/mrbgems/mruby-fiber/test/fiber.rb index b6ecb798c..261f4c79d 100644 --- a/mrbgems/mruby-fiber/test/fiber.rb +++ b/mrbgems/mruby-fiber/test/fiber.rb @@ -139,12 +139,12 @@ end assert('Transfer to self.') do result = [] - f = Fiber.new { result << :start; f.transfer; result << :end } + f = Fiber.new { result << :start; f.transfer; result << :end } f.transfer assert_equal [:start, :end], result result = [] - f = Fiber.new { result << :start; f.transfer; result << :end } + f = Fiber.new { result << :start; f.transfer; result << :end } f.resume assert_equal [:start, :end], result end diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index ee4811773..6fec1c17d 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -1,6 +1,6 @@ class Hash - # ISO does not define Hash#each_pair, so each_pair is defined in gem. + # ISO does not define Hash#each_pair, so each_pair is defined in gem. alias each_pair each ## @@ -65,7 +65,7 @@ class Hash # hsh.merge!(other_hash..) -> hsh # hsh.merge!(other_hash..){|key, oldval, newval| block} -> hsh # - # Adds the contents of _other_hash_ to _hsh_. If no block is specified, + # Adds the contents of _other_hash_ to _hsh_. If no block is specified, # entries with duplicate keys are overwritten with the values from # _other_hash_, otherwise the value of each duplicate key is determined by # calling the block with the key, its value in _hsh_ and its value in @@ -217,8 +217,8 @@ class Hash # # Returns a new array that is a one-dimensional flattening of this # hash. That is, for every key or value that is an array, extract - # its elements into the new array. Unlike Array#flatten, this - # method does not flatten recursively by default. The optional + # its elements into the new array. Unlike Array#flatten, this + # method does not flatten recursively by default. The optional # level argument determines the level of recursion to flatten. # # a = {1=> "one", 2 => [2,"two"], 3 => "three"} diff --git a/mrbgems/mruby-hash-ext/test/hash.rb b/mrbgems/mruby-hash-ext/test/hash.rb index e60eb09b2..a705af658 100644 --- a/mrbgems/mruby-hash-ext/test/hash.rb +++ b/mrbgems/mruby-hash-ext/test/hash.rb @@ -47,7 +47,7 @@ end assert('Hash#merge!') do a = { 'abc_key' => 'abc_value', 'cba_key' => 'cba_value' } - b = { 'cba_key' => 'XXX', 'xyz_key' => 'xyz_value' } + b = { 'cba_key' => 'XXX', 'xyz_key' => 'xyz_value' } result_1 = a.merge! b diff --git a/mrbgems/mruby-io/test/file.rb b/mrbgems/mruby-io/test/file.rb index c13850607..5a8a8dfac 100644 --- a/mrbgems/mruby-io/test/file.rb +++ b/mrbgems/mruby-io/test/file.rb @@ -46,7 +46,7 @@ end assert('File.extname') do assert_equal '.txt', File.extname('foo/foo.txt') - assert_equal '.gz', File.extname('foo/foo.tar.gz') + assert_equal '.gz', File.extname('foo/foo.tar.gz') assert_equal '', File.extname('foo/bar') assert_equal '', File.extname('foo/.bar') assert_equal '', File.extname('foo.txt/bar') diff --git a/mrbgems/mruby-metaprog/test/metaprog.rb b/mrbgems/mruby-metaprog/test/metaprog.rb index 006108062..d55c05557 100644 --- a/mrbgems/mruby-metaprog/test/metaprog.rb +++ b/mrbgems/mruby-metaprog/test/metaprog.rb @@ -272,13 +272,13 @@ end assert('Module#instance_methods', '15.2.2.4.33') do module Test4InstanceMethodsA - def method1() end + def method1() end end class Test4InstanceMethodsB - def method2() end + def method2() end end class Test4InstanceMethodsC < Test4InstanceMethodsB - def method3() end + def method3() end end r = Test4InstanceMethodsC.instance_methods(true) diff --git a/mrbgems/mruby-string-ext/mrblib/string.rb b/mrbgems/mruby-string-ext/mrblib/string.rb index 4ae0fb7ac..87f8ab9a0 100644 --- a/mrbgems/mruby-string-ext/mrblib/string.rb +++ b/mrbgems/mruby-string-ext/mrblib/string.rb @@ -273,7 +273,7 @@ class String # call-seq: # str.center(width, padstr=' ') -> new_str # - # Centers +str+ in +width+. If +width+ is greater than the length of +str+, + # Centers +str+ in +width+. If +width+ is greater than the length of +str+, # returns a new String of length +width+ with +str+ centered and padded with # +padstr+; otherwise, returns +str+. # @@ -372,7 +372,7 @@ class String # Iterates through successive values, starting at str and # ending at other_str inclusive, passing each value in turn to # the block. The String#succ method is used to generate - # each value. If optional second argument exclusive is omitted or is false, + # each value. If optional second argument exclusive is omitted or is false, # the last value will be included; otherwise it will be excluded. # # If no block is given, an enumerator is returned instead. diff --git a/mrblib/array.rb b/mrblib/array.rb index 4646951f7..f3d121d78 100644 --- a/mrblib/array.rb +++ b/mrblib/array.rb @@ -176,7 +176,7 @@ class Array # Each object in each array is compared (using <=>). If any value isn't # equal, then that inequality is the return value. If all the # values found are equal, then the return is based on a - # comparison of the array lengths. Thus, two arrays are + # comparison of the array lengths. Thus, two arrays are # "equal" according to Array#<=> if and only if they have # the same length and the value of each element is equal to the # value of the corresponding element in the other array. @@ -263,7 +263,7 @@ class Array lsize = lary.size # The entity sharing between lary and self may cause a large memory - # copy operation in the merge loop below. This harmless operation + # copy operation in the merge loop below. This harmless operation # cancels the sharing and provides a huge performance gain. lary[0] = lary[0] diff --git a/mrblib/hash.rb b/mrblib/hash.rb index e57c18212..85dc9778c 100644 --- a/mrblib/hash.rb +++ b/mrblib/hash.rb @@ -167,7 +167,7 @@ class Hash # into a copy of +self+. # # Each argument in +other_hashes+ must be a \Hash. - # Adds the contents of _other_hash_ to _hsh_. If no block is specified, + # Adds the contents of _other_hash_ to _hsh_. If no block is specified, # entries with duplicate keys are overwritten with the values from # _other_hash_, otherwise the value of each duplicate key is determined by # calling the block with the key, its value in _hsh_ and its value in diff --git a/test/assert.rb b/test/assert.rb index 8cd2b375b..7563099e8 100644 --- a/test/assert.rb +++ b/test/assert.rb @@ -4,7 +4,7 @@ $ko_test = 0 $kill_test = 0 $warning_test = 0 $skip_test = 0 -$asserts = [] +$asserts = [] $test_start = Time.now if Object.const_defined?(:Time) # For bintest on Ruby @@ -257,7 +257,7 @@ end # Matches any one character. # # [_SET_], [^_SET_] ([!_SET_]) :: -# Matches any one character in _SET_. Behaves like character sets in +# Matches any one character in _SET_. Behaves like character sets in # Regexp, including set negation ([^a-z]). # # {_A_,_B_} :: diff --git a/test/t/integer.rb b/test/t/integer.rb index 5a5098b92..64028638f 100644 --- a/test/t/integer.rb +++ b/test/t/integer.rb @@ -68,7 +68,7 @@ assert('Integer#%', '15.2.8.3.5') do d = 2%-5 e = -2%5 f = -2%-5 - g = 2%-2 + g = 2%-2 h = -2%2 i = -2%-2 diff --git a/test/t/lang.rb b/test/t/lang.rb index 4ed1b3daf..1f83bafec 100755 --- a/test/t/lang.rb +++ b/test/t/lang.rb @@ -1,4 +1,4 @@ -# The aim of these tests is to detect pitfall for optimized VM. +# The aim of these tests is to detect pitfall for optimized VM. # Test for or/and # diff --git a/test/t/module.rb b/test/t/module.rb index bcff595d3..8179ac78d 100644 --- a/test/t/module.rb +++ b/test/t/module.rb @@ -356,16 +356,16 @@ end assert('Module#method_defined?', '15.2.2.4.34') do module Test4MethodDefined module A - def method1() end + def method1() end end class B - def method2() end + def method2() end end class C < B include A - def method3() end + def method3() end end end