class Ameba::Runner


Represents a runner for inspecting sources files. Holds a list of rules to do inspection based on, list of sources to run inspection on and a formatter to prepare a report.

config = Ameba::Config.load
runner = config # => true or false

Defined in:



Instance Method Summary

Constructor Detail

def : Config) #

Instantiates a runner using a config.

config = Ameba::Config.load
config.files = files
config.formatter = formatter config

[View source]

Instance Method Detail

def explain(location, output = STDOUT) #

Explains an issue at a specified location.

Runner should perform inspection before doing the explain. This is necessary to be able to find the issue at a specified location.

runner = config
runner.explain({file: file, line: l, column: c})

[View source]
def run #

Performs the inspection. Iterates through all sources and test it using list of rules. If a specific rule fails on a specific source, it adds an issue to that source.

This action also notifies formatter when inspection is started/finished, and when a specific source started/finished to be inspected.

runner = config # => returns runner again

[View source]
def sources : Array(Source) #

A list of sources to run inspection on.

[View source]
def success? #

Indicates whether the last inspection successful or not. It returns true if no issues matching severity in sources found, false otherwise.

runner = config
runner.success? # => true or false

[View source]