Class: Rubocop::Cop::Style::AsciiIdentifiers
- Defined in:
- lib/rubocop/cop/style/ascii_identifiers.rb
Overview
This cop checks for non-ascii characters in indentifier names.
Constant Summary collapse
- MSG =
'Use only ascii symbols in identifiers.'
Instance Attribute Summary
Attributes inherited from Cop
#autocorrect, #debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods inherited from Cop
#add_offence, #autocorrect_action, cop_name, cop_type, #do_autocorrect, #ignore_node, inherited, #initialize, lint?, #name, rails?, style?
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#inspect(source_buffer, source, tokens, ast, comments) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/rubocop/cop/style/ascii_identifiers.rb', line 12 def inspect(source_buffer, source, tokens, ast, comments) tokens.each do |t| if t.type == :tIDENTIFIER && t.text =~ /[^\x00-\x7f]/ add_offence(:convention, t.pos, MSG) end end end |