Sha256: 785a698609eb4595e142ab64367a6048a577c3760b482ff2b8f62a08b9f41803

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 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 /(\( *[^ ]|[^\s] *\))/ do |match|
          match.each { |str| check(str, index, engine) }
        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

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.15.0 lib/scss_lint/linter/space_between_parens.rb