Class: PreCommit::Checks::ScssLint

Inherits:
Shell show all
Defined in:
lib/plugins/pre_commit/checks/scss_lint.rb

Instance Attribute Summary

Attributes inherited from Plugin

#config, #pluginator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Plugin

#initialize, #name

Constructor Details

This class inherits a constructor from PreCommit::Checks::Plugin

Class Method Details

.descriptionObject


28
29
30
# File 'lib/plugins/pre_commit/checks/scss_lint.rb', line 28

def self.description
  "Runs scss lint to detect errors"
end

Instance Method Details

#alternate_config_fileObject


24
25
26
# File 'lib/plugins/pre_commit/checks/scss_lint.rb', line 24

def alternate_config_file
  '.scss-lint.yml'
end

#call(staged_files) ⇒ Object


7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/plugins/pre_commit/checks/scss_lint.rb', line 7

def call(staged_files)
  staged_files = staged_files.grep(/\.scss$/)
  return if staged_files.empty?

  result =
  in_groups(staged_files).map do |files|
    args = %w{scss-lint} + config_file_flag + files
    execute(args)
  end.compact

  result.empty? ? nil : result.join("\n")
end

#config_file_flagObject


20
21
22
# File 'lib/plugins/pre_commit/checks/scss_lint.rb', line 20

def config_file_flag
  config_file ? ['-c', config_file] : []
end