Sha256: aa2a897135287c98eaac8009b4e935f6918bfdf8822dece799c8a794d8e03bdd
Contents?: true
Size: 973 Bytes
Versions: 1
Compression:
Stored size: 973 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.gsub(%r{((//|/\*).*$)}, '').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 location = Location.new(index + 1) message = "Expected #{pluralize(@spaces, 'space')}" << " between parentheses instead of #{spaces}" @lints << Lint.new(engine.filename, location, message) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss-lint-0.23.0 | lib/scss_lint/linter/space_between_parens.rb |