Sha256: 4e3f4fd8ee2062c802f8ea5cc3137d8956dd5691141bcc3f0877f3c65988d8bb
Contents?: true
Size: 624 Bytes
Versions: 35
Compression:
Stored size: 624 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks symbol literal syntax. # # @example # # # bad # :"symbol" # # # good # :symbol class SymbolLiteral < Base extend AutoCorrector MSG = 'Do not use strings for word-like symbol literals.' def on_sym(node) return unless /\A:["'][A-Za-z_]\w*["']\z/.match?(node.source) add_offense(node) do |corrector| corrector.replace(node, node.source.delete(%q('"))) end end end end end end
Version data entries
35 entries across 35 versions & 3 rubygems