Sha256: 2def91c46cc0fc9c430089781f10ac86a031f11df93a3a7a390cc53e034ae605

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

module RuboCop
  module Cop
    module <%= cop_type %>
      class <%= class_name %> < Cop
        MSG = "<%= error_message %>"

        def_node_matcher :matches?, <<~PATTERN
          <%= match_pattern %>
        PATTERN

        def on_<%= node_type %>(node)
          return false unless matches?(node)

          add_offense(node,
            message: MSG,
            location: :<%= node_location.to_sym %>,
            severity: :<%= offense_severity.to_sym %>
          )
        end

        # def autocorrect(node)
        #   lambda do |corrector|
        #     corrector.replace(
        #       node.loc.<%= node_location.to_s %>,
        #       "<NEW_CODE_HERE>"
        #     )
        #   end
        # end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
offense_to_corrector-0.0.2 lib/offense_to_corrector/templates/autocorrector_template.erb
offense_to_corrector-0.0.1 lib/offense_to_corrector/templates/autocorrector_template.erb