Sha256: 1b70dbb27d83fd99254e226d5c3e98528ef210cb45afd8d5ffb32af9ec024dab

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

require 'rails_best_practices/checks/check'

module RailsBestPractices
  module Checks
    class KeepFindersOnTheirOwnModelCheck < Check
      
      def interesting_nodes
        [:call]
      end

      def interesting_files
        /models\/.*rb/
      end

      def evaluate_start(node)
        add_error "keep finders on their own model" if others_finder?(node)
      end

      private

      def others_finder?(node)
        node.message == :find and node.subject.node_type == :call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-0.2.1 lib/rails_best_practices/checks/keep_finders_on_their_own_model_check.rb