Sha256: 3c560d877f8324d19613837615052bc74ed2715e8a02e016bf692a0054276a55

Contents?: true

Size: 912 Bytes

Versions: 30

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'bigfiles' tool support to quality gem
    module Jscs
      private

      def jscs_args
        '-r unix ' + js_files.join(' ')
      end

      def jscs_check_configured
        return 0 if js_files.empty?

        puts 'No JSCS config found!  To generate one, run ' \
             'jscs --auto-configure representative_file.js'
        0
      end

      def jscs_count_violations_on_line(line)
        if line =~ /^.*:\d+:\d+: /
          1
        elsif line =~ /^No configuration found/
          jscs_check_configured
        else
          0
        end
      end

      def quality_jscs
        ratchet_quality_cmd('jscs',
                            args: jscs_args,
                            gives_error_code_on_violations: true) do |line|
          jscs_count_violations_on_line(line)
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
quality-32.1.1 lib/quality/tools/jscs.rb
quality-32.1.0 lib/quality/tools/jscs.rb
quality-32.0.0 lib/quality/tools/jscs.rb
quality-31.3.0 lib/quality/tools/jscs.rb
quality-31.2.1 lib/quality/tools/jscs.rb
quality-31.2.0 lib/quality/tools/jscs.rb
quality-31.1.0 lib/quality/tools/jscs.rb
quality-31.0.0 lib/quality/tools/jscs.rb
quality-30.0.1 lib/quality/tools/jscs.rb
quality-30.0.0 lib/quality/tools/jscs.rb
quality-29.0.0 lib/quality/tools/jscs.rb
quality-28.0.0 lib/quality/tools/jscs.rb
quality-27.4.0 lib/quality/tools/jscs.rb
quality-27.3.1 lib/quality/tools/jscs.rb
quality-27.3.0 lib/quality/tools/jscs.rb
quality-27.2.0 lib/quality/tools/jscs.rb
quality-27.1.1 lib/quality/tools/jscs.rb
quality-27.1.0 lib/quality/tools/jscs.rb
quality-27.0.0 lib/quality/tools/jscs.rb
quality-26.0.0 lib/quality/tools/jscs.rb