lib/pelusa/lint/short_identifiers.rb in pelusa-0.2.1 vs lib/pelusa/lint/short_identifiers.rb in pelusa-0.2.2

- old
+ new

@@ -1,8 +1,10 @@ module Pelusa module Lint class ShortIdentifiers + RESERVED_NAMES = ['p', 'pp', 'id'] + def initialize @violations = Set.new end def check(klass) @@ -24,10 +26,10 @@ def iterate_lines!(klass) iterator = Iterator.new do |node| if node.respond_to?(:name) name = node.name.respond_to?(:name) ? node.name.name.to_s : node.name.to_s - if name =~ /[a-z]/ && name.length < 3 && !["p", "pp"].include?(name) + if name =~ /[a-z]/ && name.length < 3 && !RESERVED_NAMES.include?(name) next if name =~ /^[A-Z]/ # Ignore constants @violations << [name, node.line] end end end