Class: RuboCop::Kata::Plan

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/kata/plan.rb

Constant Summary collapse

STAGES =
{
  "structure" => %w[
    Kata/ConstructorDiscipline Kata/NoClassMethodLogic Kata/NoHashAsObject
    Kata/NoBooleanFlag Kata/IoDiscipline Kata/ClockDiscipline Kata/EnvDiscipline
  ],
  "naming" => %w[
    Kata/RealWords Kata/GoodMethodName Kata/GoodVariableName Kata/GoodClassName
    Kata/GoodModuleName Kata/BuilderNoun
  ],
  "prose" => %w[Kata/NoComments Kata/ProsePlacement]
}.freeze
REST =
"rest"
ROW =
"%-10s %6d  %s"
NEXT =
"next: %s — %d offense%s in %d file%s%s"
MINTS =
"; these mint the names `naming` then prices, so take them first"
DENSE =
"densest: %s (%d)"
CLEAN =
"clean"

Instance Method Summary collapse

Constructor Details

#initialize(root, io: $stdout) ⇒ Plan

Returns a new instance of Plan.



25
26
27
28
# File 'lib/rubocop/kata/plan.rb', line 25

def initialize(root, io: $stdout)
  @root = root
  @io = io
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
# File 'lib/rubocop/kata/plan.rb', line 30

def run
  found = offenses
  return clean if found.empty?
  STAGES.keys.push(REST).each { row(it, found) }
  advise(found)
  1
end