Sha256: f9e25553c302a8e9d508eaa237723b84b24667cbbd93cd502f84a0ce227fc870
Contents?: true
Size: 999 Bytes
Versions: 7
Compression:
Stored size: 999 Bytes
Contents
# encoding: utf-8 module RuboCop module Cop # Classes that include this module just implement functions to determine # what is an offense and how to do auto-correction. They get help with # adding offenses for the faulty string nodes, and with filtering out # nodes. module StringHelp # Regex matches IF there is a ' or there is a \\ in the string that is # not preceeded/followed by another \\ (e.g. "\\x34") but not "\\\\". ESCAPED_CHAR_REGEXP = /(?<! \\) \\{2}* \\ (?! \\)/x def on_str(node) # Constants like __FILE__ are handled as strings, # but don't respond to begin. return unless node.loc.respond_to?(:begin) && node.loc.begin return if part_of_ignored_node?(node) if offense?(node) add_offense(node, :expression) { opposite_style_detected } else correct_style_detected end end def on_regexp(node) ignore_node(node) end end end end
Version data entries
7 entries across 7 versions & 2 rubygems