Class: Policial::StyleGuides::Scss

Inherits:
Base
  • Object
show all
Defined in:
lib/policial/style_guides/scss.rb

Overview

Public: Determine SCSS style guide violations per-line.

Constant Summary collapse

KEY =
:scss

Instance Method Summary collapse

Methods inherited from Base

#config_file, #initialize, #investigate?

Constructor Details

This class inherits a constructor from Policial::StyleGuides::Base

Instance Method Details

#default_config_fileObject



29
30
31
32
# File 'lib/policial/style_guides/scss.rb', line 29

def default_config_file
  require 'scss_lint'
  SCSSLint::Config::FILE_NAME
end

#exclude_file?(filename) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/policial/style_guides/scss.rb', line 21

def exclude_file?(filename)
  config.excluded_file?(File.expand_path(filename))
end

#filename_patternObject



25
26
27
# File 'lib/policial/style_guides/scss.rb', line 25

def filename_pattern
  /.+\.scss\z/
end

#violations_in_file(file) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/policial/style_guides/scss.rb', line 9

def violations_in_file(file)
  absolute_path = File.expand_path(file.filename)

  runner = new_runner

  tempfile_from(file.filename, file.content) do |tempfile|
    runner.run([{ file: tempfile, path: absolute_path }])
  end

  violations(runner, file)
end