Class: Reviewer::Doctor::ToolInventory

Inherits:
Object
  • Object
show all
Defined in:
lib/reviewer/doctor/tool_inventory.rb

Overview

Reports the status of each configured tool

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(report, configuration:, tools:) ⇒ ToolInventory

Creates a tool inventory check that reports batch/skip status for each tool

Parameters:

  • the report to add findings to

  • the configuration to check

  • the tools collection to report on



15
16
17
18
19
# File 'lib/reviewer/doctor/tool_inventory.rb', line 15

def initialize(report, configuration:, tools:)
  @report = report
  @configuration = configuration
  @tools = tools
end

Instance Attribute Details

#reportObject (readonly)

Returns the value of attribute report.



7
8
9
# File 'lib/reviewer/doctor/tool_inventory.rb', line 7

def report
  @report
end

Instance Method Details

#checkObject

Reports batch/skip status and available commands for each configured tool



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/reviewer/doctor/tool_inventory.rb', line 22

def check
  return unless @configuration.file.exist?

  @tools.all.each do |tool|
    report.add_configured_tool(
      key: tool.key,
      name: tool.name,
      skip_in_batch: tool.skip_in_batch?,
      commands: configured_commands(tool),
      files: configured_files(tool),
      source: { path: configuration_path, location: tool.key.to_s }
    )
  end
end