Sha256: d2eb9a415020b45ec603d0b3bdedc98fc685e4afae580b97e417f5b6bf698241

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

# encoding: utf-8
module Phare
  class Check
    class JSHint < Check
      attr_reader :config, :path

      def initialize(directory)
        @config = File.expand_path("#{directory}.jshintrc", __FILE__)
        @path = File.expand_path("#{directory}app/assets/javascripts", __FILE__)
        @glob = File.join(@path, '**/*')
      end

      def command
        "jshint --config #{@config} --extra-ext .js,.es6.js #{@glob}"
      end

    protected

      def should_run?
        !Phare.system_output('which jshint').empty? && File.exists?(@config) && Dir.exists?(@path)
      end

      def print_banner
        Phare.puts '---------------------------------------------'
        Phare.puts 'Running JSHint to check for JavaScript style…'
        Phare.puts '---------------------------------------------'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phare-0.4 lib/phare/check/jshint.rb