Class: Inch::CLI::Command::Suggest

Inherits:
List show all
Defined in:
lib/inch/cli/command/suggest.rb

Constant Summary collapse

EXIT_CODE_PENDING_SUGGESTIONS =
10

Constants inherited from Base

Base::EXIT_STATUS_SUCCESS

Instance Attribute Summary

Attributes inherited from BaseList

#objects

Attributes inherited from Base

#codebase

Instance Method Summary collapse

Methods inherited from BaseList

#prepare_codebase

Methods inherited from Base

#initialize, #name, register_command_as, run

Methods included from TraceHelper

#ui

Constructor Details

This class inherits a constructor from Inch::CLI::Command::Base

Instance Method Details

#descriptionObject



12
13
14
# File 'lib/inch/cli/command/suggest.rb', line 12

def description
  'Suggests some objects to be documented (better)'
end

#exit_statusFixnum

Returns 10 if suggestions were found, zero otherwise.

Returns:

  • (Fixnum)

    10 if suggestions were found, zero otherwise



38
39
40
# File 'lib/inch/cli/command/suggest.rb', line 38

def exit_status
  objects.empty? ? super : EXIT_CODE_PENDING_SUGGESTIONS
end

#run(*args) ⇒ void

This method returns an undefined value.

Runs the commandline utility, parsing arguments and displaying a list of objects

Parameters:

  • args (Array<String>)

    the list of arguments.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/inch/cli/command/suggest.rb', line 25

def run(*args)
  prepare_codebase(*args)
  context = API::Suggest.new(codebase, @options)
  self.objects = context.objects
  if @options.format == Options::Suggest::FORMAT_TEXT
    Output::Suggest.new(@options, context.all_objects, objects,
                        context.grade_lists, context.files)
  else
    Output::Stats.new(@options, context.all_objects, context.grade_lists)
  end
end

#usageObject



16
17
18
# File 'lib/inch/cli/command/suggest.rb', line 16

def usage
  'Usage: inch suggest [paths] [options]'
end