Class: Pelusa::Lint::ShortIdentifiers

Inherits:
Object
  • Object
show all
Defined in:
lib/pelusa/lint/short_identifiers.rb

Constant Summary collapse

RESERVED_NAMES =
['p', 'pp', 'id']

Instance Method Summary collapse

Constructor Details

#initializeShortIdentifiers

Returns a new instance of ShortIdentifiers.



6
7
8
# File 'lib/pelusa/lint/short_identifiers.rb', line 6

def initialize
  @violations = Set.new
end

Instance Method Details

#check(klass) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/pelusa/lint/short_identifiers.rb', line 10

def check(klass)
  iterate_lines!(klass)

  return SuccessfulAnalysis.new(name) if @violations.empty?

  FailedAnalysis.new(name, formatted_violations) do |violations|
    "Names are too short: #{violations.join(', ')}"
  end
end