Sha256: 1ec98b74ea07f76d0079a1d226e249f3c64d57c78511b195bf3c500eef076f4d

Contents?: true

Size: 803 Bytes

Versions: 5

Compression:

Stored size: 803 Bytes

Contents

module Quality
  module Tools
    # Adds 'rubocop' tool support to quality gem
    module Rubocop
      private

      def rubocop_args
        "--format emacs #{ruby_files.join(' ')}"
      end

      def quality_rubocop
        ratchet_quality_cmd('rubocop',
                            gives_error_code_on_violations: true,
                            args: rubocop_args) do |line|
          self.class.count_rubocop_violations(line)
        end
      end

      def self.included(base)
        base.extend ClassMethods
      end

      # See Rubocop.included
      module ClassMethods
        def count_rubocop_violations(line)
          if line =~ /^.* file[s|] inspected, (.*) offence[s|] detected$/
            0
          else
            1
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quality-16.0.1 lib/quality/tools/rubocop.rb
quality-16.0.0 lib/quality/tools/rubocop.rb
quality-15.0.1 lib/quality/tools/rubocop.rb
quality-15.0.0 lib/quality/tools/rubocop.rb
quality-14.1.0 lib/quality/tools/rubocop.rb