Sha256: 94ee19b6c340b726f6e589f8397efaec0e78717f40689854e74db51d1391492e

Contents?: true

Size: 728 Bytes

Versions: 30

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

module Quality
  module Tools
    # Adds 'rubocop' tool support to quality gem
    module RailsBestPractices
      def self.included(base)
        base.extend ClassMethods
      end

      private

      def quality_rails_best_practices
        ratchet_quality_cmd('rails_best_practices',
                            gives_error_code_on_violations: true) do |line|
          self.class.count_rails_best_practices_violations(line)
        end
      end

      # See Rubocop.included
      module ClassMethods
        def count_rails_best_practices_violations(line)
          if line =~ /.*:[0-9]* - /
            1
          else
            0
          end
        end
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

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