Sha256: 24c63f9c606d28a5f7826945e77f922b21f587467c0f63a96de14c97ffddc700

Contents?: true

Size: 827 Bytes

Versions: 12

Compression:

Stored size: 827 Bytes

Contents

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

      def rubocop_args
        "--require rubocop-rspec --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

12 entries across 12 versions & 1 rubygems

Version Path
quality-19.2.0 lib/quality/tools/rubocop.rb
quality-19.1.3 lib/quality/tools/rubocop.rb
quality-19.1.2 lib/quality/tools/rubocop.rb
quality-19.1.1 lib/quality/tools/rubocop.rb
quality-19.1.0 lib/quality/tools/rubocop.rb
quality-19.0.0 lib/quality/tools/rubocop.rb
quality-18.0.1 lib/quality/tools/rubocop.rb
quality-18.0.0 lib/quality/tools/rubocop.rb
quality-17.2.0 lib/quality/tools/rubocop.rb
quality-17.1.1 lib/quality/tools/rubocop.rb
quality-17.1.0 lib/quality/tools/rubocop.rb
quality-17.0.0 lib/quality/tools/rubocop.rb