Class: RailsBestPractices::Checks::OveruseRouteCustomizationsCheck

### Home Classes Methods

### In Files

- lib/rails_best_practices/checks/overuse_route_customizations_check.rb

### Parent

RailsBestPractices::Checks::Check

### Methods

- ::new
- #evaluate_start
- #interesting_files
- #interesting_nodes

### Files

- LICENSE

### Class/Module Index

Quicksearch

- RailsBestPractices
- RailsBestPractices::Checks
- RailsBestPractices::Checks::AddModelVirtualAttributeCheck
- RailsBestPractices::Checks::AlwaysAddDbIndexCheck
- RailsBestPractices::Checks::Check
- RailsBestPractices::Checks::IsolateSeedDataCheck
- RailsBestPractices::Checks::KeepFindersOnTheirOwnModelCheck
- RailsBestPractices::Checks::LawOfDemeterCheck
- RailsBestPractices::Checks::ManyToManyCollectionCheck
- RailsBestPractices::Checks::MoveCodeIntoControllerCheck
- RailsBestPractices::Checks::MoveCodeIntoHelperCheck
- RailsBestPractices::Checks::MoveCodeIntoModelCheck
- RailsBestPractices::Checks::MoveFinderToNamedScopeCheck
- RailsBestPractices::Checks::MoveModelLogicIntoModelCheck
- RailsBestPractices::Checks::NeedlessDeepNestingCheck
- RailsBestPractices::Checks::NestedModelFormsCheck
- RailsBestPractices::Checks::NotUseDefaultRouteCheck
- RailsBestPractices::Checks::OveruseRouteCustomizationsCheck
- RailsBestPractices::Checks::ReplaceComplexCreationWithFactoryMethodCheck
- RailsBestPractices::Checks::ReplaceInstanceVariableWithLocalVariableCheck
- RailsBestPractices::Checks::UseBeforeFilterCheck
- RailsBestPractices::Checks::UseModelAssociationCheck
- RailsBestPractices::Checks::UseModelCallbackCheck
- RailsBestPractices::Checks::UseObserverCheck
- RailsBestPractices::Checks::UseScopeAccessCheck
- RailsBestPractices::Core
- RailsBestPractices::Core::CheckingVisitor
- RailsBestPractices::Core::Error
- RailsBestPractices::Core::Runner
- Enumerable
- NilClass
- Sexp
- String

No matching classes.

# RailsBestPractices::Checks::OveruseRouteCustomizationsCheck

Check config/routes.rb to make sure there are no much route customizations.

Implementation: check member and collection route count, if more than customize_count, then it is overuse route customizations.

### Public Class Methods

new(options = {}) click to toggle source

    # File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 18
    def initialize(options = {})
      super()
      @customize_count = options['customize_count'] || 3
    end

### Public Instance Methods

evaluate_start(node) click to toggle source

    # File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 23
    def evaluate_start(node)
      if :resources == node.message
        add_error "overuse route customizations (customize_count > #{@customize_count})" if member_and_collection_count(node) > @customize_count
      end
    end

interesting_files() click to toggle source

    # File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 14
    def interesting_files
      /config\/routes.rb/
    end

interesting_nodes() click to toggle source

    # File lib/rails_best_practices/checks/overuse_route_customizations_check.rb, line 10
    def interesting_nodes
      [:call]
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.