class

Ameba::Runner

Inherits Reference < Object

Represents a runner for inspecting source 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 = Ameba::Runner.new(config)
runner.run.success? # => true or false

Constructors

new(config : Config)

Instantiates a runner using a config.

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

runner = Ameba::Runner.new(config)
Source

Instance methods

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 = Ameba::Runner.new(config)
runner.run
runner.explain(Crystal::Location.new(file, line, column))
Source
root

Project root path.

Source
run

Performs the inspection. Iterates through all sources and tests them 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 = Ameba::Runner.new(config)
runner.run # => returns runner again
Source
sources

A list of sources to run inspection on.

Source
success?

Indicates whether the last inspection successful or not. It returns true if no issues are found, false otherwise.

runner = Ameba::Runner.new(config)
runner.run
runner.success? # => true or false
Source
version

Returns an ameba version up to which the rules should be run.

Source
version=(version : SemanticVersion | Nil)

Returns an ameba version up to which the rules should be run.

Source

Nested types