Class: SCSSLint::Runner
- Inherits:
-
Object
- Object
- SCSSLint::Runner
- Defined in:
- lib/scss_lint/runner.rb
Overview
Finds and aggregates all lints found by running the registered linters against a set of SCSS files.
Instance Attribute Summary collapse
-
#linters ⇒ Object
readonly
Returns the value of attribute linters.
-
#lints ⇒ Object
readonly
Returns the value of attribute lints.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #lints? ⇒ Boolean
- #run(files = []) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/scss_lint/runner.rb', line 11 def initialize( = {}) @lints = [] included_linters = LinterRegistry. extract_linters_from(.fetch(:included_linters, [])) included_linters = LinterRegistry.linters if included_linters.empty? excluded_linters = LinterRegistry. extract_linters_from(.fetch(:excluded_linters, [])) @linters = (included_linters - excluded_linters).map(&:new) end |
Instance Attribute Details
#linters ⇒ Object (readonly)
Returns the value of attribute linters.
9 10 11 |
# File 'lib/scss_lint/runner.rb', line 9 def linters @linters end |
#lints ⇒ Object (readonly)
Returns the value of attribute lints.
9 10 11 |
# File 'lib/scss_lint/runner.rb', line 9 def lints @lints end |
Instance Method Details
#lints? ⇒ Boolean
38 39 40 |
# File 'lib/scss_lint/runner.rb', line 38 def lints? lints.any? end |
#run(files = []) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/scss_lint/runner.rb', line 25 def run(files = []) raise NoFilesError, 'No SCSS files specified' if files.empty? raise NoLintersError, 'No linters specified' if linters.empty? files.each do |file| find_lints(file) end linters.each do |linter| @lints += linter.lints end end |