Sha256: 59cf8d3cb89aa3184587b2dd0cbdf28a099579b978fdd64e9b6ae9fb131e76cb

Contents?: true

Size: 890 Bytes

Versions: 3

Compression:

Stored size: 890 Bytes

Contents

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

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

      def jscs_check_configured
        return if js_files_arr.empty?

        puts 'No JSCS config found!  To generate one, run ' \
             'jscs --auto-configure ' + js_files_arr.join(' ')
        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

3 entries across 3 versions & 1 rubygems

Version Path
quality-19.2.0 lib/quality/tools/jscs.rb
quality-19.1.3 lib/quality/tools/jscs.rb
quality-19.1.2 lib/quality/tools/jscs.rb