Sha256: 085bacce0b8715d2578c29dd84f73e9dda38715171eb310207a6ca5a68a59abd

Contents?: true

Size: 523 Bytes

Versions: 214

Compression:

Stored size: 523 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for cops checking single/double quotes.
    module StringLiteralsHelp
      private

      def wrong_quotes?(src_or_node)
        src = src_or_node.is_a?(RuboCop::AST::Node) ? src_or_node.source : src_or_node
        return false if src.start_with?('%', '?')

        if style == :single_quotes
          !double_quotes_required?(src)
        else
          !/" | \\[^'\\] | \#[@{$]/x.match?(src)
        end
      end
    end
  end
end

Version data entries

214 entries across 205 versions & 21 rubygems

Version Path
harbr-0.1.60 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.59 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.58 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.57 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.56 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.55 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.54 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.53 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.52 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.50 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.49 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.48 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.47 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.46 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.45 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.44 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.43 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.42 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.41 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb
harbr-0.1.39 vendor/bundle/ruby/3.2.0/gems/rubocop-1.57.2/lib/rubocop/cop/mixin/string_literals_help.rb