Sha256: 694caf4b7592ee963858420ea73a3c8937319b233b4599a4de384a046ddcb572
Contents?: true
Size: 913 Bytes
Versions: 7
Compression:
Stored size: 913 Bytes
Contents
module SCSSLint # Checks for the presence of spaces between parentheses. class Linter::SpaceBetweenParens < Linter include LinterRegistry def visit_root(node) @spaces = config['spaces'] engine.lines.each_with_index do |line, index| line.scan(/ (^(\t|\s)*\))? # Capture leading spaces and tabs followed by a `)` ( \([ ]*(?!$) # Find `( ` as long as its not EOL ) | [ ]*\) )? /x) do |match| check(match[2], index, engine) if match[2] end end end private def check(str, index, engine) spaces = str.count ' ' if spaces != @spaces @lints << Lint.new(engine.filename, index + 1, "Expected #{pluralize(@spaces, 'space')}" << " between parentheses instead of #{spaces}") end end end end
Version data entries
7 entries across 7 versions & 1 rubygems