Sha256: ea06a84b8a4157d9909e1a67ce996056a45562f6d65b5182d7168283a1d18bc8
Contents?: true
Size: 653 Bytes
Versions: 11
Compression:
Stored size: 653 Bytes
Contents
require 'rails_best_practices/checks/check' module RailsBestPractices module Checks # Check a model to make sure finders are on their own model. # # Implementation: check if :find is called by other model. 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
11 entries across 11 versions & 1 rubygems