From 4a950f335fe06d4c937b77b12584daf71f766de8 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 17 Jan 2021 01:40:32 +0000 Subject: [PATCH 1/5] Auto corrected by following Lint Ruby Lint/DeprecatedClassMethods --- lib/synvert/core/rewriter/gem_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/synvert/core/rewriter/gem_spec.rb b/lib/synvert/core/rewriter/gem_spec.rb index 6d5ad45c..83462aca 100644 --- a/lib/synvert/core/rewriter/gem_spec.rb +++ b/lib/synvert/core/rewriter/gem_spec.rb @@ -27,7 +27,7 @@ def initialize(name, comparator) # @raise [Synvert::Core::GemfileLockNotFound] raise if Gemfile.lock does not exist. def match? gemfile_lock_path = File.join(Configuration.instance.get(:path), 'Gemfile.lock') - if File.exists? gemfile_lock_path + if File.exist? gemfile_lock_path parser = Bundler::LockfileParser.new(File.read(gemfile_lock_path)) if spec = parser.specs.find { |spec| spec.name == @name } Gem::Version.new(spec.version).send(OPERATORS[@operator], @version) From 47e45dc62546fa2a597c781cdd379c6fd0194571 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 17 Jan 2021 01:42:34 +0000 Subject: [PATCH 2/5] Auto corrected by following Lint Ruby Style/SelfAssignment --- lib/synvert/core/rewriter/condition/if_exist_condition.rb | 2 +- lib/synvert/core/rewriter/condition/unless_exist_condition.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/synvert/core/rewriter/condition/if_exist_condition.rb b/lib/synvert/core/rewriter/condition/if_exist_condition.rb index 16d74ec3..8cf1b36e 100644 --- a/lib/synvert/core/rewriter/condition/if_exist_condition.rb +++ b/lib/synvert/core/rewriter/condition/if_exist_condition.rb @@ -7,7 +7,7 @@ class Rewriter::IfExistCondition < Rewriter::Condition def match? match = false @instance.current_node.recursive_children do |child_node| - match = match || (child_node && child_node.match?(@rules)) + match ||= (child_node && child_node.match?(@rules)) end match end diff --git a/lib/synvert/core/rewriter/condition/unless_exist_condition.rb b/lib/synvert/core/rewriter/condition/unless_exist_condition.rb index 3dc27eac..b51eb60c 100644 --- a/lib/synvert/core/rewriter/condition/unless_exist_condition.rb +++ b/lib/synvert/core/rewriter/condition/unless_exist_condition.rb @@ -7,7 +7,7 @@ class Rewriter::UnlessExistCondition < Rewriter::Condition def match? match = false @instance.current_node.recursive_children do |child_node| - match = match || (child_node && child_node.match?(@rules)) + match ||= (child_node && child_node.match?(@rules)) end !match end From 8a7d88f636db325d6abe824ff2518d79e6e5f514 Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 17 Jan 2021 02:03:09 +0000 Subject: [PATCH 3/5] Auto corrected by following Lint Ruby Style/SafeNavigation --- lib/synvert/core/node_ext.rb | 4 +--- lib/synvert/core/rewriter/condition/if_exist_condition.rb | 2 +- lib/synvert/core/rewriter/condition/unless_exist_condition.rb | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/synvert/core/node_ext.rb b/lib/synvert/core/node_ext.rb index 046adbfb..07101a93 100644 --- a/lib/synvert/core/node_ext.rb +++ b/lib/synvert/core/node_ext.rb @@ -299,9 +299,7 @@ def debug_info # # @return [String] source code. def to_source - if self.loc.expression - self.loc.expression.source - end + self.loc.expression&.source end # Get the indent of current node. diff --git a/lib/synvert/core/rewriter/condition/if_exist_condition.rb b/lib/synvert/core/rewriter/condition/if_exist_condition.rb index 8cf1b36e..d3b8dfc4 100644 --- a/lib/synvert/core/rewriter/condition/if_exist_condition.rb +++ b/lib/synvert/core/rewriter/condition/if_exist_condition.rb @@ -7,7 +7,7 @@ class Rewriter::IfExistCondition < Rewriter::Condition def match? match = false @instance.current_node.recursive_children do |child_node| - match ||= (child_node && child_node.match?(@rules)) + match ||= (child_node&.match?(@rules)) end match end diff --git a/lib/synvert/core/rewriter/condition/unless_exist_condition.rb b/lib/synvert/core/rewriter/condition/unless_exist_condition.rb index b51eb60c..a66105ed 100644 --- a/lib/synvert/core/rewriter/condition/unless_exist_condition.rb +++ b/lib/synvert/core/rewriter/condition/unless_exist_condition.rb @@ -7,7 +7,7 @@ class Rewriter::UnlessExistCondition < Rewriter::Condition def match? match = false @instance.current_node.recursive_children do |child_node| - match ||= (child_node && child_node.match?(@rules)) + match ||= (child_node&.match?(@rules)) end !match end From d58f2e0375af78c442263ea77862ad9bdae3b7fe Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 17 Jan 2021 02:07:06 +0000 Subject: [PATCH 4/5] Auto corrected by following Lint Ruby Style/RedundantSelf --- lib/synvert/core/node_ext.rb | 154 +++++++++++++------------- lib/synvert/core/rewriter.rb | 4 +- lib/synvert/core/rewriter/instance.rb | 6 +- 3 files changed, 82 insertions(+), 82 deletions(-) diff --git a/lib/synvert/core/node_ext.rb b/lib/synvert/core/node_ext.rb index 07101a93..f84fe0b5 100644 --- a/lib/synvert/core/node_ext.rb +++ b/lib/synvert/core/node_ext.rb @@ -31,15 +31,15 @@ class Node # @return [Parser::AST::Node] name node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def name - case self.type + case type when :class, :module, :def, :arg, :blockarg, :restarg - self.children[0] + children[0] when :defs, :const - self.children[1] + children[1] when :mlhs self else - raise Synvert::Core::MethodNotSupported.new "name is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "name is not handled for #{debug_info}" end end @@ -48,10 +48,10 @@ def name # @return [Parser::AST::Node] parent_class node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def parent_class - if :class == self.type - self.children[1] + if :class == type + children[1] else - raise Synvert::Core::MethodNotSupported.new "parent_class is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "parent_class is not handled for #{debug_info}" end end @@ -60,10 +60,10 @@ def parent_class # @return [Parser::AST::Node] parent const node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def parent_const - if :const == self.type - self.children[0] + if :const == type + children[0] else - raise Synvert::Core::MethodNotSupported.new "parent_const is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "parent_const is not handled for #{debug_info}" end end @@ -72,10 +72,10 @@ def parent_const # @return [Parser::AST::Node] receiver node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def receiver - if :send == self.type - self.children[0] + if :send == type + children[0] else - raise Synvert::Core::MethodNotSupported.new "receiver is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "receiver is not handled for #{debug_info}" end end @@ -84,13 +84,13 @@ def receiver # @return [Parser::AST::Node] mesage node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def message - case self.type + case type when :super, :zsuper :super when :send - self.children[1] + children[1] else - raise Synvert::Core::MethodNotSupported.new "message is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "message is not handled for #{debug_info}" end end @@ -99,17 +99,17 @@ def message # @return [Array] arguments node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def arguments - case self.type + case type when :def, :block - ArgumentsNode.new self.children[1] + ArgumentsNode.new children[1] when :defs - ArgumentsNode.new self.children[2] + ArgumentsNode.new children[2] when :send - self.children[2..-1] + children[2..-1] when :defined? - self.children + children else - raise Synvert::Core::MethodNotSupported.new "arguments is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "arguments is not handled for #{debug_info}" end end @@ -118,10 +118,10 @@ def arguments # @return [Parser::AST::Node] caller node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def caller - if :block == self.type - self.children[0] + if :block == type + children[0] else - raise Synvert::Core::MethodNotSupported.new "caller is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "caller is not handled for #{debug_info}" end end @@ -130,19 +130,19 @@ def caller # @return [Array] body node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def body - case self.type + case type when :begin - self.children + children when :def, :block - return [] if self.children[2].nil? + return [] if children[2].nil? - :begin == self.children[2].type ? self.children[2].body : self.children[2..-1] + :begin == children[2].type ? children[2].body : children[2..-1] when :defs - return [] if self.children[3].nil? + return [] if children[3].nil? - :begin == self.children[3].type ? self.children[3].body : self.children[3..-1] + :begin == children[3].type ? children[3].body : children[3..-1] else - raise Synvert::Core::MethodNotSupported.new "body is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "body is not handled for #{debug_info}" end end @@ -151,10 +151,10 @@ def body # @return [Parser::AST::Node] condition node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def condition - if :if == self.type - self.children[0] + if :if == type + children[0] else - raise Synvert::Core::MethodNotSupported.new "condition is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "condition is not handled for #{debug_info}" end end @@ -163,10 +163,10 @@ def condition # @return [Array] keys node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def keys - if :hash == self.type - self.children.map { |child| child.children[0] } + if :hash == type + children.map { |child| child.children[0] } else - raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{debug_info}" end end @@ -175,10 +175,10 @@ def keys # @return [Array] values node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def values - if :hash == self.type - self.children.map { |child| child.children[1] } + if :hash == type + children.map { |child| child.children[1] } else - raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{debug_info}" end end @@ -188,10 +188,10 @@ def values # @return [Boolean] true if specified key exists. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def has_key?(key) - if :hash == self.type - self.children.any? { |pair_node| pair_node.key.to_value == key } + if :hash == type + children.any? { |pair_node| pair_node.key.to_value == key } else - raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{debug_info}" end end @@ -201,11 +201,11 @@ def has_key?(key) # @return [Parser::AST::Node] value node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def hash_value(key) - if :hash == self.type - value_node = self.children.find { |pair_node| pair_node.key.to_value == key } + if :hash == type + value_node = children.find { |pair_node| pair_node.key.to_value == key } value_node ? value_node.value : nil else - raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{debug_info}" end end @@ -214,10 +214,10 @@ def hash_value(key) # @return [Parser::AST::Node] key node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def key - if :pair == self.type - self.children.first + if :pair == type + children.first else - raise Synvert::Core::MethodNotSupported.new "key is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "key is not handled for #{debug_info}" end end @@ -226,10 +226,10 @@ def key # @return [Parser::AST::Node] value node. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def value - if :pair == self.type - self.children.last + if :pair == type + children.last else - raise Synvert::Core::MethodNotSupported.new "value is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "value is not handled for #{debug_info}" end end @@ -238,10 +238,10 @@ def value # @return [Parser::AST::Node] variable nodes. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def left_value - if %i[masgn lvasgn ivasgn].include? self.type - self.children[0] + if %i[masgn lvasgn ivasgn].include? type + children[0] else - raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{debug_info}" end end @@ -250,10 +250,10 @@ def left_value # @return [Array] variable nodes. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def right_value - if %i[masgn lvasgn ivasgn].include? self.type - self.children[1] + if %i[masgn lvasgn ivasgn].include? type + children[1] else - raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{debug_info}" end end @@ -262,36 +262,36 @@ def right_value # @return [Object] exact value. # @raise [Synvert::Core::MethodNotSupported] if calls on other node. def to_value - case self.type + case type when :int, :str, :sym - self.children.last + children.last when :true true when :false false when :array - self.children.map(&:to_value) + children.map(&:to_value) when :irange - (self.children.first.to_value..self.children.last.to_value) + (children.first.to_value..children.last.to_value) when :begin - self.children.first.to_value + children.first.to_value else - raise Synvert::Core::MethodNotSupported.new "to_value is not handled for #{self.debug_info}" + raise Synvert::Core::MethodNotSupported.new "to_value is not handled for #{debug_info}" end end def to_s - if :mlhs == self.type - "(#{self.children.map(&:name).join(', ')})" + if :mlhs == type + "(#{children.map(&:name).join(', ')})" end end def debug_info "\n" + [ - "file: #{self.loc.expression.source_buffer.name}", - "line: #{self.loc.expression.line}", - "source: #{self.to_source}", - "node: #{self.inspect}" + "file: #{loc.expression.source_buffer.name}", + "line: #{loc.expression.line}", + "source: #{to_source}", + "node: #{inspect}" ].join("\n") end @@ -299,21 +299,21 @@ def debug_info # # @return [String] source code. def to_source - self.loc.expression&.source + loc.expression&.source end # Get the indent of current node. # # @return [Integer] indent. def indent - self.loc.expression.column + loc.expression.column end # Get the line of current node. # # @return [Integer] line. def line - self.loc.expression.line + loc.expression.line end # Recursively iterate all child nodes of current node. @@ -321,7 +321,7 @@ def line # @yield [child] Gives a child node. # @yieldparam child [Parser::AST::Node] child node def recursive_children - self.children.each do |child| + children.each do |child| if Parser::AST::Node === child yield child child.recursive_children { |c| yield c } @@ -361,8 +361,8 @@ def match?(rules) def rewritten_source(code) code.gsub(/{{(.*?)}}/m) do old_code = $1 - if self.respond_to? old_code.split(/\.|\[/).first - evaluated = self.instance_eval old_code + if respond_to? old_code.split(/\.|\[/).first + evaluated = instance_eval old_code case evaluated when Parser::AST::Node evaluated.loc.expression.source diff --git a/lib/synvert/core/rewriter.rb b/lib/synvert/core/rewriter.rb index f436d843..b2a65c5b 100644 --- a/lib/synvert/core/rewriter.rb +++ b/lib/synvert/core/rewriter.rb @@ -151,14 +151,14 @@ def initialize(group, name, &block) # Process the rewriter. # It will call the block. def process - self.instance_eval &@block + instance_eval &@block end # Process rewriter with sandbox mode. # It will call the block but doesn't change any file. def process_with_sandbox @sandbox = true - self.process + process @sandbox = false end diff --git a/lib/synvert/core/rewriter/instance.rb b/lib/synvert/core/rewriter/instance.rb index 7886f9ac..1cd9f552 100644 --- a/lib/synvert/core/rewriter/instance.rb +++ b/lib/synvert/core/rewriter/instance.rb @@ -79,7 +79,7 @@ def initialize(rewriter, file_pattern, options={}, &block) @file_pattern = file_pattern @options = DEFAULT_OPTIONS.merge(options) @block = block - rewriter.helpers.each { |helper| self.singleton_class.send(:define_method, helper[:name], &helper[:block]) } + rewriter.helpers.each { |helper| singleton_class.send(:define_method, helper[:name], &helper[:block]) } end # Process the instance. @@ -96,7 +96,7 @@ def process @current_file = file_path - self.process_with_node ast do + process_with_node ast do begin instance_eval &@block rescue NoMethodError @@ -146,7 +146,7 @@ def process_with_node(node) # @param node [Parser::AST::Node] node set to current_node # @yield process def process_with_other_node(node) - original_node = self.current_node + original_node = current_node self.current_node = node yield self.current_node = original_node From 52d07dea7ef8e5789c3ca57b99233a4b8eafd86b Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 17 Jan 2021 02:14:23 +0000 Subject: [PATCH 5/5] Auto corrected by following Lint Ruby Style/RaiseArgs --- lib/synvert/core/node_ext.rb | 40 +++++++++++++-------------- lib/synvert/core/rewriter.rb | 4 +-- lib/synvert/core/rewriter/gem_spec.rb | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/synvert/core/node_ext.rb b/lib/synvert/core/node_ext.rb index f84fe0b5..05e15643 100644 --- a/lib/synvert/core/node_ext.rb +++ b/lib/synvert/core/node_ext.rb @@ -39,7 +39,7 @@ def name when :mlhs self else - raise Synvert::Core::MethodNotSupported.new "name is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "name is not handled for #{debug_info}" end end @@ -51,7 +51,7 @@ def parent_class if :class == type children[1] else - raise Synvert::Core::MethodNotSupported.new "parent_class is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "parent_class is not handled for #{debug_info}" end end @@ -63,7 +63,7 @@ def parent_const if :const == type children[0] else - raise Synvert::Core::MethodNotSupported.new "parent_const is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "parent_const is not handled for #{debug_info}" end end @@ -75,7 +75,7 @@ def receiver if :send == type children[0] else - raise Synvert::Core::MethodNotSupported.new "receiver is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "receiver is not handled for #{debug_info}" end end @@ -90,7 +90,7 @@ def message when :send children[1] else - raise Synvert::Core::MethodNotSupported.new "message is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "message is not handled for #{debug_info}" end end @@ -109,7 +109,7 @@ def arguments when :defined? children else - raise Synvert::Core::MethodNotSupported.new "arguments is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "arguments is not handled for #{debug_info}" end end @@ -121,7 +121,7 @@ def caller if :block == type children[0] else - raise Synvert::Core::MethodNotSupported.new "caller is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "caller is not handled for #{debug_info}" end end @@ -142,7 +142,7 @@ def body :begin == children[3].type ? children[3].body : children[3..-1] else - raise Synvert::Core::MethodNotSupported.new "body is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "body is not handled for #{debug_info}" end end @@ -154,7 +154,7 @@ def condition if :if == type children[0] else - raise Synvert::Core::MethodNotSupported.new "condition is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "condition is not handled for #{debug_info}" end end @@ -166,7 +166,7 @@ def keys if :hash == type children.map { |child| child.children[0] } else - raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "keys is not handled for #{debug_info}" end end @@ -178,7 +178,7 @@ def values if :hash == type children.map { |child| child.children[1] } else - raise Synvert::Core::MethodNotSupported.new "keys is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "keys is not handled for #{debug_info}" end end @@ -191,7 +191,7 @@ def has_key?(key) if :hash == type children.any? { |pair_node| pair_node.key.to_value == key } else - raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "has_key? is not handled for #{debug_info}" end end @@ -205,7 +205,7 @@ def hash_value(key) value_node = children.find { |pair_node| pair_node.key.to_value == key } value_node ? value_node.value : nil else - raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "has_key? is not handled for #{debug_info}" end end @@ -217,7 +217,7 @@ def key if :pair == type children.first else - raise Synvert::Core::MethodNotSupported.new "key is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "key is not handled for #{debug_info}" end end @@ -229,7 +229,7 @@ def value if :pair == type children.last else - raise Synvert::Core::MethodNotSupported.new "value is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "value is not handled for #{debug_info}" end end @@ -241,7 +241,7 @@ def left_value if %i[masgn lvasgn ivasgn].include? type children[0] else - raise Synvert::Core::MethodNotSupported.new "left_value is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "left_value is not handled for #{debug_info}" end end @@ -253,7 +253,7 @@ def right_value if %i[masgn lvasgn ivasgn].include? type children[1] else - raise Synvert::Core::MethodNotSupported.new "right_value is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "right_value is not handled for #{debug_info}" end end @@ -276,7 +276,7 @@ def to_value when :begin children.first.to_value else - raise Synvert::Core::MethodNotSupported.new "to_value is not handled for #{debug_info}" + raise Synvert::Core::MethodNotSupported, "to_value is not handled for #{debug_info}" end end @@ -387,7 +387,7 @@ def rewritten_source(code) when NilClass 'nil' else - raise Synvert::Core::MethodNotSupported.new "rewritten_source is not handled for #{evaluated.inspect}" + raise Synvert::Core::MethodNotSupported, "rewritten_source is not handled for #{evaluated.inspect}" end else "{{#{old_code}}}" @@ -444,7 +444,7 @@ def match_value?(actual, expected) when Parser::AST::Node actual == expected else - raise Synvert::Core::MethodNotSupported.new "#{expected.class} is not handled for match_value?" + raise Synvert::Core::MethodNotSupported, "#{expected.class} is not handled for match_value?" end end diff --git a/lib/synvert/core/rewriter.rb b/lib/synvert/core/rewriter.rb index b2a65c5b..a58829fd 100644 --- a/lib/synvert/core/rewriter.rb +++ b/lib/synvert/core/rewriter.rb @@ -65,7 +65,7 @@ def fetch(group, name) if exist? group, name rewriters[group][name] else - raise RewriterNotFound.new "Rewriter #{group} #{name} not found" + raise RewriterNotFound, "Rewriter #{group} #{name} not found" end end @@ -82,7 +82,7 @@ def call(group, name) rewriter.process rewriter else - raise RewriterNotFound.new "Rewriter #{group}/#{name} not found" + raise RewriterNotFound, "Rewriter #{group}/#{name} not found" end end diff --git a/lib/synvert/core/rewriter/gem_spec.rb b/lib/synvert/core/rewriter/gem_spec.rb index 83462aca..bd6da267 100644 --- a/lib/synvert/core/rewriter/gem_spec.rb +++ b/lib/synvert/core/rewriter/gem_spec.rb @@ -35,7 +35,7 @@ def match? false end else - raise GemfileLockNotFound.new 'Gemfile.lock does not exist' + raise GemfileLockNotFound, 'Gemfile.lock does not exist' end end end