123456789_123456789_123456789_123456789_123456789_

Module: RuboCop::Cop::ForbiddenPattern

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rubocop/cop/mixin/forbidden_pattern.rb

Overview

This module encapsulates the ability to forbid certain patterns in a cop.

Instance Method Summary

Instance Method Details

#forbidden_pattern?(name) ⇒ Boolean

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/forbidden_pattern.rb', line 7

def forbidden_pattern?(name)
  forbidden_patterns.any? { |pattern| Regexp.new(pattern).match?(name) }
end

#forbidden_patterns

[ GitHub ]

  
# File 'lib/rubocop/cop/mixin/forbidden_pattern.rb', line 11

def forbidden_patterns
  cop_config.fetch('ForbiddenPatterns', [])
end