Class: RuboCop::Cop::RSpec::VariableName
- Includes:
- AllowedPattern, ConfigurableNaming, InsideExampleGroup, Variable
- Defined in:
- lib/rubocop/cop/rspec/variable_name.rb
Overview
Checks that memoized helper names use the configured style.
Variables can be excluded from checking using the ‘AllowedPatterns` option.
Constant Summary collapse
- MSG =
'Use %<style>s for variable names.'
Constants included from Variable
RuboCop::Cop::RSpec::Variable::Helpers, RuboCop::Cop::RSpec::Variable::Subjects
Instance Method Summary collapse
Methods included from Variable
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#on_send(node) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/rubocop/cop/rspec/variable_name.rb', line 49 def on_send(node) return unless inside_example_group?(node) variable_definition?(node) do |variable| return if variable.dstr_type? || variable.dsym_type? return if matches_allowed_pattern?(variable.value) check_name(node, variable.value, variable.source_range) end end |