module Reviewer

Primary interface for the reviewer tools

Constants

VERSION

Public Class Methods

arguments() click to toggle source

The collection of arguments that were passed via the command line.

@return [Reviewer::Arguments] exposes tags, files, and keywords from arguments

# File lib/reviewer.rb, line 55
def arguments
  @arguments ||= Arguments.new
end
configuration() click to toggle source

Exposes the configuration options for Reviewer.

@return [Reviewer::Configuration] configuration settings instance

# File lib/reviewer.rb, line 85
def configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source

A block approach to configuring Reviewer.

@example Set configuration file path

Reviewer.configure do |config|
  config.file = '~/configuration.yml'
end

@return [Reviewer::Configuration] Reviewer configuration settings

# File lib/reviewer.rb, line 97
def configure
  yield(configuration)
end
format(clear_screen: false) click to toggle source

Runs the `format` command for the specified tools/files for which it is configured. @param clear_streen [boolean] clears the screen to reduce noise when true

@return [void] Prints output to the console

# File lib/reviewer.rb, line 48
def format(clear_screen: false)
  perform(:format, clear_screen: clear_screen)
end
history() click to toggle source

A file store for sharing information across runs

@return [Reviewer::History] a YAML::Store (or Pstore) containing data on tools

# File lib/reviewer.rb, line 78
def history
  @history ||= History.new
end
output() click to toggle source

The primary output method for Reviewer to consistently display success/failure details for a unique run of each tool and the collective summary when relevant.

@return [Reviewer::Output] prints formatted output to the console.

# File lib/reviewer.rb, line 71
def output
  @output ||= Output.new
end
reset!() click to toggle source

Resets the loaded tools

# File lib/reviewer.rb, line 31
def reset!
  @tools = nil
end
review(clear_screen: false) click to toggle source

Runs the `review` command for the specified tools/files. Reviewer expects all configured commands that are not disabled to have an entry for the `review` command. @param clear_streen [boolean] clears the screen to reduce noise when true

@return [void] Prints output to the console

# File lib/reviewer.rb, line 40
def review(clear_screen: false)
  perform(:review, clear_screen: clear_screen)
end
tools() click to toggle source

An interface for the collection of configured tools for accessing subsets of tools based on enabled/disabled, tags, keywords, etc.

@return [Reviewer::Tools] exposes the set of tools to be run in a given context

# File lib/reviewer.rb, line 63
def tools
  @tools ||= Tools.new
end

Private Class Methods

perform(command_type, clear_screen: false) click to toggle source

Provides a consistent approach to running and benchmarking commmands and preventing further execution of later tools if a command fails. @param command_type [Symbol] the specific command to run for each tool

@example Run the `review` command for each relevant tool

perform(:review)

@return [Hash] the exit status (in integer format) for each command run

# File lib/reviewer.rb, line 111
def perform(command_type, clear_screen: false)
  system('clear') if clear_screen

  results = Batch.run(command_type, tools.current)

  # Return the largest exit status
  exit results.values.max
end