Cleanup missing whitespace after comma

* There must be a code metric tool helping me in converting my style.
This commit is contained in:
Markus Schirp 2012-07-31 04:10:37 +02:00
parent 3963166344
commit d50ecc483d
43 changed files with 157 additions and 157 deletions

View file

@ -24,7 +24,7 @@ module Mutant
raise ArgumentError, 'Can only build constant mutation scope from class or module'
end
new(value,*arguments)
new(value, *arguments)
end
# Return ast wrapping mutated node
@ -35,7 +35,7 @@ module Mutant
#
def root(node)
root = root_ast
root.body = @scope_class.new(1,root.name,node)
root.body = @scope_class.new(1, root.name, node)
Rubinius::AST::Script.new(root)
end
@ -66,8 +66,8 @@ module Mutant
#
# @api private
#
def initialize(constant,keyword,scope_class)
@constant,@keyword,@scope_class = constant,keyword,scope_class
def initialize(constant, keyword, scope_class)
@constant, @keyword, @scope_class = constant, keyword, scope_class
end
# Return new root ast

View file

@ -77,7 +77,7 @@ module Mutant
# @api private
#
def initialize(constant_name, method_name)
@constant_name,@method_name = constant_name, method_name
@constant_name, @method_name = constant_name, method_name
end
# Return method
@ -171,7 +171,7 @@ module Mutant
def mutatee
node = matched_node
if node
Mutatee.new(context,node)
Mutatee.new(context, node)
end
end
@ -182,7 +182,7 @@ module Mutant
# @api private
#
def constant
constant_name.split('::').inject(::Object) do |parent,name|
constant_name.split('::').inject(::Object) do |parent, name|
parent.const_get(name)
end
end

View file

@ -31,7 +31,7 @@ module Mutant
#
def each(&block)
return to_enum unless block_given?
Mutator.each(node,&block)
Mutator.each(node, &block)
self
end
@ -64,8 +64,8 @@ module Mutant
#
# @api private
#
def initialize(context,node)
@context,@node = context,node
def initialize(context, node)
@context, @node = context, node
end
# Insert AST node under context

View file

@ -13,9 +13,9 @@ module Mutant
#
# @api private
#
def self.each(node,&block)
return to_enum(__method__,node) unless block_given?
generator(node).new(node,block)
def self.each(node, &block)
return to_enum(__method__, node) unless block_given?
generator(node).new(node, block)
self
end
@ -49,8 +49,8 @@ module Mutant
#
# @api private
#
def initialize(node,block)
@node,@block = node,block
def initialize(node, block)
@node, @block = node, block
dispatch
end
@ -163,8 +163,8 @@ module Mutant
#
# @api private
#
def emit(node_class,*arguments)
emit_safe(new(node_class,*arguments))
def emit(node_class, *arguments)
emit_safe(new(node_class, *arguments))
end
# Create a new AST node with same class as wrapped node
@ -174,7 +174,7 @@ module Mutant
# @api private
#
def new_self(*arguments)
new(node.class,*arguments)
new(node.class, *arguments)
end
# Create a new AST node with Rubnius::AST::NilLiteral class
@ -195,8 +195,8 @@ module Mutant
#
# @api private
#
def new(node_class,*arguments)
node_class.new(node.line,*arguments)
def new(node_class, *arguments)
node_class.new(node.line, *arguments)
end
# Emit a new AST node with same class as wrapped node
@ -248,7 +248,7 @@ module Mutant
# @api private
#
def emit_elements(elements)
elements.each_with_index do |element,index|
elements.each_with_index do |element, index|
dup_elements = elements.dup
Mutator.each(element).each do |mutation|
dup_elements[index]=mutation
@ -274,7 +274,7 @@ module Mutant
# @api private
#
def negative_infinity
new(Rubinius::AST::Negate,infinity)
new(Rubinius::AST::Negate, infinity)
end
# Return AST representing infinity
@ -284,7 +284,7 @@ module Mutant
# @api private
#
def infinity
new_call(new_float(1),:/,new_float(0))
new_call(new_float(1), :/, new_float(0))
end
@ -298,8 +298,8 @@ module Mutant
#
# @api private
#
def new_call(receiver,name,arguments)
new(Rubinius::AST::SendWithArguments,receiver,name,arguments)
def new_call(receiver, name, arguments)
new(Rubinius::AST::SendWithArguments, receiver, name, arguments)
end
# Return new float literal
@ -311,7 +311,7 @@ module Mutant
# @api private
#
def new_float(value)
new(Rubinius::AST::FloatLiteral,value)
new(Rubinius::AST::FloatLiteral, value)
end
# Return AST representing NaN
@ -321,7 +321,7 @@ module Mutant
# @api private
#
def nan
new_call(new_float(0),:/,new_float(0))
new_call(new_float(0), :/, new_float(0))
end
memoize :sexp

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit_safe(inverse(node.start,node.finish))
emit_safe(inverse(node.start, node.finish))
emit_range
end
@ -24,11 +24,11 @@ module Mutant
# @api private
#
def emit_range
start,finish = node.start,node.finish
emit_self(negative_infinity,finish)
emit_self(nan,finish)
emit_self(start,infinity)
emit_self(start,nan)
start, finish = node.start, node.finish
emit_self(negative_infinity, finish)
emit_self(nan, finish)
emit_self(start, infinity)
emit_self(start, nan)
end
# Return inverse AST node class

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit(Rubinius::AST::ArrayLiteral,[new_nil])
emit(Rubinius::AST::ArrayLiteral, [new_nil])
end
end
end

View file

@ -24,7 +24,7 @@ module Mutant
# @api private
#
def values
[0,1,-node.value]
[0, 1, -node.value]
end
end
end

View file

@ -25,7 +25,7 @@ module Mutant
# @api private
#
def values
[0.0,1.0] << -node.value
[0.0, 1.0] << -node.value
end
end
end

View file

@ -55,7 +55,7 @@ module Mutant
# @api private
#
def emit_element_presence
0.step(array.length-1,2) do |index|
0.step(array.length-1, 2) do |index|
contents = dup_array
contents.delete_at(index)
contents.delete_at(index)

View file

@ -12,7 +12,7 @@ module Mutant
# @api private
#
def inverse(*arguments)
new(Rubinius::AST::RangeExclude,*arguments)
new(Rubinius::AST::RangeExclude, *arguments)
end
end
end

View file

@ -12,7 +12,7 @@ module Mutant
# @api private
#
def inverse(*arguments)
new(Rubinius::AST::Range,*arguments)
new(Rubinius::AST::Range, *arguments)
end
end
end

View file

@ -13,7 +13,7 @@ module Mutant
#
def dispatch
emit_nil
emit_new { new_self(Mutant.random_hex_string,node.options) }
emit_new { new_self(Mutant.random_hex_string, node.options) }
end
end
end

View file

@ -41,9 +41,9 @@ module Mutant
# @api private
#
def define_singleton_method(name)
class_eval(<<-RUBY,__FILE__,__LINE__+1)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def #{name}(*)
raise NotImplementedError,"\#{self.name}.\#{__method__} is not implemented"
raise NotImplementedError, "\#{self.name}.\#{__method__} is not implemented"
end
RUBY
end
@ -57,9 +57,9 @@ module Mutant
# @api private
#
def define_instance_method(name)
class_eval(<<-RUBY,__FILE__,__LINE__+1)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def #{name}(*)
raise NotImplementedError,"\#{self.class.name}#\#{__method__} is not implemented"
raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented"
end
RUBY
end

View file

@ -7,7 +7,7 @@ if "".respond_to?(:to_ast)
end
end
describe Mutant,'code loading' do
describe Mutant, 'code loading' do
let(:context) { Mutant::Context::Constant.build(CodeLoadingSubject) }
let(:node) { 'def foo; :bar; end'.to_ast }
let(:root) { context.root(node) }

View file

@ -1,10 +1,10 @@
require 'spec_helper'
if "".respond_to?(:to_ast)
describe Mutant,'method matching' do
describe Mutant, 'method matching' do
after do
if defined?(::Foo)
Object.send(:remove_const,'Foo')
Object.send(:remove_const, 'Foo')
end
end

View file

@ -8,8 +8,8 @@ unless defined?(Rubinius)
attr_accessor :body
def initialize(line,name,body=[])
@line,@name,@body = line,name,body
def initialize(line, name, body=[])
@line, @name, @body = line, name, body
end
end
@ -27,16 +27,16 @@ unless defined?(Rubinius)
# Dummy class node
class Class < Node
def initialize(line,name,superclass,body)
super(line,name)
@superclass,@body = superclass,body
def initialize(line, name, superclass, body)
super(line, name)
@superclass, @body = superclass, body
end
end
# Dummy module node
class Module < Node
def initialize(line,name,body)
super(line,name)
def initialize(line, name, body)
super(line, name)
@body = body
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Context::Constant,'.build' do
describe Mutant::Context::Constant, '.build' do
subject { described_class.build(constant) }
let(:object) { described_class }
@ -14,7 +14,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Module.new }
it 'should initialize context correctly' do
described_class.should_receive(:new).with(constant,'module',Rubinius::AST::ModuleScope).and_return(context)
described_class.should_receive(:new).with(constant, 'module', Rubinius::AST::ModuleScope).and_return(context)
should be(context)
end
@ -25,7 +25,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Class.new }
it 'should initialize context correctly' do
described_class.should_receive(:new).with(constant,'class',Rubinius::AST::ClassScope).and_return(context)
described_class.should_receive(:new).with(constant, 'class', Rubinius::AST::ClassScope).and_return(context)
should be(context)
end
@ -36,7 +36,7 @@ describe Mutant::Context::Constant,'.build' do
let(:constant) { Object.new }
it 'should raise error' do
expect { subject }.to raise_error(ArgumentError,'Can only build constant mutation scope from class or module')
expect { subject }.to raise_error(ArgumentError, 'Can only build constant mutation scope from class or module')
end
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Context,'#root' do
describe Mutant::Context, '#root' do
subject { object.root(mock) }
let(:object) { described_class.allocate }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Loader,'.load' do
describe Mutant::Loader, '.load' do
subject { object.load(node) }
let(:object) { described_class }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Matcher,'#context' do
describe Mutant::Matcher, '#context' do
subject { object.context }
let(:object) { described_class.new(constant_name) }

View file

@ -3,12 +3,12 @@ require 'spec_helper'
# This spec is only present to ensure 100% test coverage.
# The code should not be triggered on runtime.
describe Mutant::Matcher,'#each' do
describe Mutant::Matcher, '#each' do
subject { object.send(:each) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher#each is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher#each is not implemented')
end
end

View file

@ -38,7 +38,7 @@ describe Mutant::Matcher::Method::Classifier, '.run' do
let(:input) { 'Foo' }
it 'should raise error' do
expect { subject }.to raise_error(ArgumentError,"Cannot determine subject from #{input.inspect}")
expect { subject }.to raise_error(ArgumentError, "Cannot determine subject from #{input.inspect}")
end
end
end

View file

@ -1,12 +1,12 @@
require 'spec_helper'
# This method cannot be called directly, spec only exists for heckle demands
describe Mutant::Matcher::Method::Classifier,'#matcher' do
describe Mutant::Matcher::Method::Classifier, '#matcher' do
subject { object.matcher }
let(:object) { described_class.send(:new,match) }
let(:object) { described_class.send(:new, match) }
let(:match) { [mock,constant_name,scope_symbol,method_name] }
let(:match) { [mock, constant_name, scope_symbol, method_name] }
let(:constant_name) { mock('Constant Name') }
let(:method_name) { 'foo' }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#context' do
describe Mutant::Matcher::Method, '#context' do
subject { object.context }
let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule','foo') }
let(:object) { described_class::Singleton.new('SampleSubjects::ExampleModule', 'foo') }
let(:context) { mock('Context') }
before do

View file

@ -2,7 +2,7 @@ require 'spec_helper'
# This method implementation cannot be called from the outside, but heckle needs to be happy.
describe Mutant::Matcher::Method,'#each' do
describe Mutant::Matcher::Method, '#each' do
let(:class_under_test) do
node = self.matched_node
Class.new(described_class) do

View file

@ -1,11 +1,11 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#method' do
describe Mutant::Matcher::Method, '#method' do
subject { object.send(:method) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#method is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#method is not implemented')
end
end

View file

@ -1,12 +1,12 @@
require 'spec_helper'
describe Mutant::Matcher::Method,'#node_class' do
describe Mutant::Matcher::Method, '#node_class' do
subject { object.send(:node_class) }
let(:object) { described_class.allocate }
it 'should raise error' do
expect { subject }.to raise_error(NotImplementedError,'Mutant::Matcher::Method#node_class is not implemented')
expect { subject }.to raise_error(NotImplementedError, 'Mutant::Matcher::Method#node_class is not implemented')
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Mutant::Mutatee,'.new' do
subject { object.new(context,ast) }
describe Mutant::Mutatee, '.new' do
subject { object.new(context, ast) }
let(:object) { described_class }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#context' do
describe Mutant::Mutatee, '#context' do
subject { object.context }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:ast) { mock('AST') }
let(:context) { mock('Context') }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#each' do
describe Mutant::Mutatee, '#each' do
subject { object.each { |item| yields << item } }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:root) { mock('Root AST') }
let(:ast) { mock('AST') }
let(:context) { mock('Context', :root => root) }

View file

@ -1,8 +1,8 @@
require 'spec_helper'
describe Mutant::Mutatee,'#node' do
describe Mutant::Mutatee, '#node' do
subject { object.node }
let(:object) { described_class.new(context,node) }
let(:object) { described_class.new(context, node) }
let(:node) { mock('Node') }
let(:context) { mock('Context') }

View file

@ -1,9 +1,9 @@
require 'spec_helper'
describe Mutant::Mutatee,'#reset' do
describe Mutant::Mutatee, '#reset' do
subject { object.reset }
let(:object) { described_class.new(context,ast) }
let(:object) { described_class.new(context, ast) }
let(:root) { mock('Root AST') }
let(:ast) { mock('AST') }
let(:context) { mock('Context', :root => root) }

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe Mutant::Mutator,'#emit_new' do
describe Mutant::Mutator, '#emit_new' do
subject { object.send(:emit_new) { node } }
class Block
@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_new' do
end
end
let(:object) { class_under_test.new(wrapped_node,block) }
let(:object) { class_under_test.new(wrapped_node, block) }
let(:block) { Block.new }
let(:wrapped_node) { '"foo"'.to_ast }
@ -45,7 +45,7 @@ describe Mutant::Mutator,'#emit_new' do
let(:node) { '"foo"'.to_ast }
it 'should raise error' do
expect { subject }.to raise_error(RuntimeError,'New AST could not be generated after 3 attempts')
expect { subject }.to raise_error(RuntimeError, 'New AST could not be generated after 3 attempts')
end
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper'
describe Mutant::Mutator,'#emit_safe' do
subject { object.send(:emit_safe,node) }
describe Mutant::Mutator, '#emit_safe' do
subject { object.send(:emit_safe, node) }
class Block
attr_reader :arguments
@ -15,7 +15,7 @@ describe Mutant::Mutator,'#emit_safe' do
end
end
let(:object) { class_under_test.new(wrapped_node,block) }
let(:object) { class_under_test.new(wrapped_node, block) }
let(:block) { Block.new }
let(:wrapped_node) { '"foo"'.to_ast }