Sha256: 361418e5dfe32a8cf0248b20a6d58fbb3d36bbce2a0a5810b728c96e3c089921

Contents?: true

Size: 889 Bytes

Versions: 15

Compression:

Stored size: 889 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 0 if js_files_arr.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

15 entries across 15 versions & 1 rubygems

Version Path
quality-22.0.0 lib/quality/tools/jscs.rb
quality-21.0.6 lib/quality/tools/jscs.rb
quality-21.0.5 lib/quality/tools/jscs.rb
quality-21.0.4 lib/quality/tools/jscs.rb
quality-21.0.3 lib/quality/tools/jscs.rb
quality-21.0.2 lib/quality/tools/jscs.rb
quality-21.0.1 lib/quality/tools/jscs.rb
quality-20.1.1 lib/quality/tools/jscs.rb
quality-21.0.0 lib/quality/tools/jscs.rb
quality-20.1.0 lib/quality/tools/jscs.rb
quality-20.0.3 lib/quality/tools/jscs.rb
quality-20.0.2 lib/quality/tools/jscs.rb
quality-20.0.1 lib/quality/tools/jscs.rb
quality-20.0.0 lib/quality/tools/jscs.rb
quality-19.2.1 lib/quality/tools/jscs.rb