lib/rubocop/cop/cop.rb in rubocop-0.10.0 vs lib/rubocop/cop/cop.rb in rubocop-0.11.0
- old
+ new
@@ -9,20 +9,20 @@
# Cops track offences and can autocorrect them of the fly.
#
# A commissioner object is responsible for traversing the AST and invoking
# the specific callbacks on each cop.
# If a cop needs to do its own processing of the AST or depends on
- # something else it should define the #investigate method and do
+ # something else it should define the `#investigate` method and do
# the processing there.
#
# @example
#
- # class CustomCop < Cop
- # def investigate(processed_source)
- # # Do custom processing
+ # class CustomCop < Cop
+ # def investigate(processed_source)
+ # # Do custom processing
+ # end
# end
- # end
class Cop
extend AST::Sexp
attr_accessor :offences
attr_accessor :debug
@@ -71,14 +71,14 @@
@autocorrect = false
@ignored_nodes = []
@corrections = []
end
- def do_autocorrect(node)
- autocorrect_action(node) if autocorrect
+ def do_autocorrect(node, *args)
+ autocorrect_action(node, *args) if autocorrect
end
- def autocorrect_action(node)
+ def autocorrect_action(node, *args)
end
def add_offence(severity, location, message)
unless @disabled_lines && @disabled_lines.include?(location.line)
message = debug ? "#{name}: #{message}" : message