Sha256: 39eecd444ba332efaa0e1b50575dae6558cb83eb2c3bdcc063cf02e46a805bd3
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
# frozen_string_literal: true module RuboCop module Cop module RSpec # Checks that memoized helper names use the configured style. # # @example EnforcedStyle: snake_case (default) # # bad # let(:userName) { 'Adam' } # subject(:userName) { 'Adam' } # # # good # let(:user_name) { 'Adam' } # subject(:user_name) { 'Adam' } # # @example EnforcedStyle: camelCase # # bad # let(:user_name) { 'Adam' } # subject(:user_name) { 'Adam' } # # # good # let(:userName) { 'Adam' } # subject(:userName) { 'Adam' } class VariableName < Cop include ConfigurableNaming include RuboCop::RSpec::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? check_name(node, variable.value, variable.loc.expression) end end private def message(style) format(MSG, style: style) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubocop-rspec-1.42.0 | lib/rubocop/cop/rspec/variable_name.rb |
rubocop-rspec-1.41.0 | lib/rubocop/cop/rspec/variable_name.rb |
rubocop-rspec-1.40.0 | lib/rubocop/cop/rspec/variable_name.rb |