Class: RakeCommandFilter::ScssLintCommandDefinition

Inherits:
CommandDefinition show all
Defined in:
lib/scss_lint_command_definition.rb

Overview

default way to run rubocop and parse its output

Instance Attribute Summary

Attributes inherited from CommandDefinition

#default_line_handling, #filter, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CommandDefinition

#add_filter, #add_parameter, create_result, #execute, find_worst_result, result_failure, result_success, result_warning

Constructor Details

#initialize(id = 'scss-lint') ⇒ ScssLintCommandDefinition

Default parser for scss lint output.

Parameters:

  • id (defaults to: 'scss-lint')

    override this if you want to do something other than ‘scss-lint’



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/scss_lint_command_definition.rb', line 15

def initialize(id = 'scss-lint')
  super(id)
  # just use sensible defaults here.
  add_filter(:scss_error, /(.*\[(.)\].*)/) do |matches|
    kind = matches[1]
    if kind == 'W'
      CommandDefinition.result_warning(ScssLintCommandDefinition.warning_msg)
    else
      CommandDefinition.result_failure(ScssLintCommandDefinition.error_msg)
    end
  end
end

Class Method Details

.error_msgObject



9
10
11
# File 'lib/scss_lint_command_definition.rb', line 9

def self.error_msg
  'One or more scss errors, see above'
end

.warning_msgObject

for testing



5
6
7
# File 'lib/scss_lint_command_definition.rb', line 5

def self.warning_msg
  'One or more scss warnings, see above'
end