# frozen_string_literal: true module RuboCop module Cop module Style # This cop checks for unnecessary single-element Regexp character classes. # # @example # # # bad # r = /[x]/ # # # good # r = /x/ # # # bad # r = /[\s]/ # # # good # r = /\s/ # # # good # r = /[ab]/ class RedundantRegexpCharacterClass < Base include MatchRange include RegexpLiteralHelp extend AutoCorrector MSG_REDUNDANT_CHARACTER_CLASS = 'Redundant single-element character class, ' \ '`%s` can be replaced with `%s`.' PATTERN = / ( (?