Sha256: fe452ac892ac58abc3257da362df9fd43964b5c28f714cafd9ddb60b87fb5868
Contents?: true
Size: 936 Bytes
Versions: 9
Compression:
Stored size: 936 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Lint # This cop checks for invalid character literals with a non-escaped # whitespace character (e.g. `? `). # However, currently it's unclear whether there's a way to emit this # warning without syntax errors. # # $ ruby -w # p(? ) # -:1: warning: invalid character syntax; use ?\s # -:1: syntax error, unexpected '?', expecting ')' # p(? ) # ^ # # @example # p(? ) class InvalidCharacterLiteral < Cop include ParserDiagnostic private def relevant_diagnostic?(diagnostic) diagnostic.reason == :invalid_escape_use end def alternative_message(diagnostic) diagnostic.message .capitalize .gsub('character syntax', 'character literal') end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems