Class: Pronto::Stylelint

Inherits:
Runner
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pronto/stylelint.rb,
lib/pronto/stylelint/config.rb,
lib/pronto/stylelint/linter.rb

Defined Under Namespace

Classes: Config, Linter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(patches, commit = nil) ⇒ Stylelint

Returns a new instance of Stylelint.



21
22
23
24
25
# File 'lib/pronto/stylelint.rb', line 21

def initialize(patches, commit = nil)
  super

  @stylelint_config ||= Pronto::Stylelint::Config.new
end

Instance Attribute Details

#stylelint_configObject (readonly)

Returns the value of attribute stylelint_config.



13
14
15
# File 'lib/pronto/stylelint.rb', line 13

def stylelint_config
  @stylelint_config
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
# File 'lib/pronto/stylelint.rb', line 27

def run
  return [] if !@patches || @patches.count.zero?

  @patches
    .select { |patch| patch.additions.positive? && style_file?(patch.new_file_full_path) }
    .flat_map { |patch| inspect(patch) }
    .compact
end