class RogerScsslint::Lint

SCSS linter plugin for Roger

Public Class Methods

new(options = {}) click to toggle source

Configurability is the root of all evil fishshell.com/docs/current/design.html#conf

# File lib/roger_scsslint/lint.rb, line 8
def initialize(options = {})
  @options = {
    config_file: ".scss-lint.yml",
    scss_lint: "scss-lint"
  }

  detect_scsslint
  @options.update(options) if options
end

Public Instance Methods

call(test, _options) click to toggle source
# File lib/roger_scsslint/lint.rb, line 18
def call(test, _options)
  test.log(self, "SCSS linting files")
  system(Shellwords.join([@options[:scss_lint], "--config=#{@options[:config_file]}"]))
end

Private Instance Methods

detect_scsslint() click to toggle source
# File lib/roger_scsslint/lint.rb, line 25
def detect_scsslint
  command = [@options[:scss_lint], "-v", ">/dev/null"]
  detect = system(Shellwords.join(command))
  fail "Could not find linter. Linter should be in Gemfile." unless detect
end