lib/rubocop/cop/rspec/variable_name.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/variable_name.rb in rubocop-rspec-2.13.0

- old
+ new

@@ -3,11 +3,11 @@ module RuboCop module Cop module RSpec # Checks that memoized helper names use the configured style. # - # Variables can be excluded from checking using the `IgnoredPatterns` + # Variables can be excluded from checking using the `AllowedPatterns` # option. # # @example EnforcedStyle: snake_case (default) # # bad # subject(:userName1) { 'Adam' } @@ -24,33 +24,32 @@ # # # good # subject(:userName1) { 'Adam' } # let(:userName2) { 'Adam' } # - # @example IgnoredPatterns configuration - # + # @example AllowedPatterns configuration # # rubocop.yml # # RSpec/VariableName: # # EnforcedStyle: snake_case - # # IgnoredPatterns: + # # AllowedPatterns: # # - ^userFood # # @example - # # okay because it matches the `^userFood` regex in `IgnoredPatterns` + # # okay because it matches the `^userFood` regex in `AllowedPatterns` # subject(:userFood_1) { 'spaghetti' } # let(:userFood_2) { 'fettuccine' } # class VariableName < Base include ConfigurableNaming - include IgnoredPattern + include AllowedPattern include Variable MSG = 'Use %<style>s for variable names.' def on_send(node) variable_definition?(node) do |variable| return if variable.dstr_type? || variable.dsym_type? - return if matches_ignored_pattern?(variable.value) + return if matches_allowed_pattern?(variable.value) check_name(node, variable.value, variable.loc.expression) end end