Class: ROM::Lint::Linter
- Inherits:
-
Object
- Object
- ROM::Lint::Linter
- Defined in:
- lib/rom/lint/linter.rb
Overview
Base class for building linters that check source code
Linters are used by authors of ROM adapters to verify that their integration complies with the ROM api.
Most of the time, authors won't need to construct linters directly because the provided test helpers will automatically run when required in tests and specs.
Direct Known Subclasses
Constant Summary collapse
- Failure =
A failure raised by +complain+
Class.new(StandardError)
Class Method Summary collapse
-
.each_lint {|String, ROM::Lint| ... } ⇒ Object
Iterate over all lint methods.
-
.lints ⇒ String
private
Return a list a lint methods.
Instance Method Summary collapse
-
#lint(name) ⇒ Object
Run a lint method.
Class Method Details
.each_lint {|String, ROM::Lint| ... } ⇒ Object
Iterate over all lint methods
28 29 30 31 32 |
# File 'lib/rom/lint/linter.rb', line 28 def self.each_lint return to_enum unless block_given? lints.each { |lint| yield lint, self } end |
.lints ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return a list a lint methods
53 54 55 |
# File 'lib/rom/lint/linter.rb', line 53 def self.lints public_instance_methods(true).grep(/^lint_/).map(&:to_s) end |
Instance Method Details
#lint(name) ⇒ Object
Run a lint method
41 42 43 44 45 46 |
# File 'lib/rom/lint/linter.rb', line 41 def lint(name) before_lint public_send name after_lint true # for assertions end |