Sha256: e206796bde76f13f2e0c3fbfc7023dcdbd4de8bd6995c2a0802319eb967b5c5c

Contents?: true

Size: 697 Bytes

Versions: 9

Compression:

Stored size: 697 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

Version Path
quality-22.0.0 lib/quality/tools/rails_best_practices.rb
quality-21.0.6 lib/quality/tools/rails_best_practices.rb
quality-21.0.5 lib/quality/tools/rails_best_practices.rb
quality-21.0.4 lib/quality/tools/rails_best_practices.rb
quality-21.0.3 lib/quality/tools/rails_best_practices.rb
quality-21.0.2 lib/quality/tools/rails_best_practices.rb
quality-21.0.1 lib/quality/tools/rails_best_practices.rb
quality-20.1.1 lib/quality/tools/rails_best_practices.rb
quality-21.0.0 lib/quality/tools/rails_best_practices.rb