Sha256: 6880525424b97be6bba8793f56be1d6351358dd2c3418a998aeafafb9d62655f

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

require "rubocop"
require "rainbow"

module Rfix::Ext
  module CommentConfig
    # Called by RuboCop on every line to see
    # if its suppose to run against it or not
    def cop_enabled_at_line?(_cop, line)
      Rfix.enabled?(processed_source.file_path, line) && super
    end
  end

  module Runner
    # Called _after_ @source has been 'auto fixed' by Rubocop
    def check_for_infinite_loop(source, offences)
      # rubocop:disable Style/Semicolon
      Rfix.refresh!(source); super
      # rubocop:enable Style/Semicolon
    end
  end

  module Options
    # Appends custom --args to RuboCop CLI
    def define_options
      super.tap do |options|
        @ons.each do |args, block|
          option(options, *args, &block)
        end
      end
    end

    # Helper method used by rfix to append cli --args to Rubocop
    def on(*args, &block)
      @ons ||= []
      @ons += [[args, block]]
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rfix-1.0.15.pre.116 lib/rfix/extensions/extensions.rb
rfix-1.0.15 lib/rfix/extensions/extensions.rb
rfix-1.0.8.pre.109 lib/rfix/extensions/extensions.rb
rfix-1.0.8.pre.108 lib/rfix/extensions/extensions.rb
rfix-1.0.7.pre.68 lib/rfix/extensions/extensions.rb
rfix-1.0.7.pre.67 lib/rfix/extensions/extensions.rb
rfix-1.0.7.pre.66 lib/rfix/extensions/extensions.rb