class Ameba::Runner
- Ameba::Runner
- Reference
- Object
Overview
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 = Ameba::Runner.new config
runner.run.success? # => true or false
Defined in:
ameba/runner.crConstructors
-
.new(config : Config)
Instantiates a runner using a
config
.
Instance Method Summary
-
#explain(location, output = STDOUT)
Explains an issue at a specified location.
-
#run
Performs the inspection.
-
#sources : Array(Source)
A list of sources to run inspection on.
-
#success?
Indicates whether the last inspection successful or not.
Constructor Detail
Instantiates a runner using a config
.
config = Ameba::Config.load
config.files = files
config.formatter = formatter
Ameba::Runner.new config
Instance Method Detail
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({file: file, line: l, column: c})
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 = Ameba::Runner.new config
runner.run # => returns runner again
Indicates whether the last inspection successful or not. It returns true if no issues matching severity in sources found, false otherwise.
runner = Ameba::Runner.new config
runner.run
runner.success? # => true or false