Sha256: ee2bfca4cd2570cfdddaeca006c01b2feccd655995f67a761304b351e0100e9c

Contents?: true

Size: 766 Bytes

Versions: 4

Compression:

Stored size: 766 Bytes

Contents

module Phare
  module Checks
    class RubyRubocop
      attr_reader :status

      def initialize
        @command = 'rubocop'
      end

      def run
        if should_run?
          print_banner
          system(@command)
          @status = $CHILD_STATUS.exitstatus

          unless @status == 0
            puts "Something went wrong. Program exited with #{@status}"
          end

          puts ''
        else
          @status = 0
        end
      end

    protected

      def should_run?
        !`which rubocop`.empty?
      end

      def print_banner
        puts '----------------------------------------'
        puts 'Running Rubocop to check for Ruby style…'
        puts '----------------------------------------'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phare-0.3 lib/phare/checks/ruby_rubocop.rb
phare-0.2.2 lib/phare/checks/ruby_rubocop.rb
phare-0.2.1 lib/phare/checks/ruby_rubocop.rb
phare-0.2 lib/phare/checks/ruby_rubocop.rb