Sha256: df7e3c17f3dfead17d3f0b7df1fa9e829b38965e40ffd3bce8aca92317f14f72

Contents?: true

Size: 901 Bytes

Versions: 4

Compression:

Stored size: 901 Bytes

Contents

# encoding: utf-8
module Phare
  class Check
    class Rubocop < Check
      def initialize(directory, options = {})
        @path = directory
        @extensions = %w(.rb)
        @options = options

        super
      end

      def command
        if @tree.changed?
          "rubocop #{files_to_check.join(' ')}"
        else
          'rubocop'
        end
      end

    protected

      def excluded_list
        configuration_file['AllCops']['Exclude'] if configuration_file['AllCops'] && configuration_file['AllCops']['Exclude']
      end

      def configuration_file
        @configuration_file ||= File.exist?('.rubocop.yml') ? YAML::load(File.open('.rubocop.yml')) : {}
      end

      def binary_exists?
        !Phare.system_output('which rubocop').empty?
      end

      def print_banner
        Phare.banner 'Running Rubocop to check for Ruby style…'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phare-1.0.1 lib/phare/check/rubocop.rb
phare-1.0.0 lib/phare/check/rubocop.rb
phare-0.7.1 lib/phare/check/rubocop.rb
phare-0.7 lib/phare/check/rubocop.rb