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-25.0.0 lib/quality/tools/rails_best_practices.rb
quality-24.0.0 lib/quality/tools/rails_best_practices.rb
quality-23.0.7 lib/quality/tools/rails_best_practices.rb
quality-23.0.6 lib/quality/tools/rails_best_practices.rb
quality-23.0.5 lib/quality/tools/rails_best_practices.rb
quality-23.0.4 lib/quality/tools/rails_best_practices.rb
quality-23.0.3 lib/quality/tools/rails_best_practices.rb
quality-23.0.2 lib/quality/tools/rails_best_practices.rb
quality-23.0.1 lib/quality/tools/rails_best_practices.rb
quality-23.0.0 lib/quality/tools/rails_best_practices.rb