Sha256: fd282127541a899a1a881950a94f05f7a6ba252a7592503484704b43a68d30a9

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

module SCSSLint
  # Checks for the presence of a single space before an opening brace.
  class Linter::SpaceBeforeBrace < Linter
    include LinterRegistry

    def visit_root(node)
      engine.lines.each_with_index do |line, index|

        if config['allow_single_line_padding'] && node_on_single_line(node)
          line.scan(/[^"#' ]\{/) do |match|
            add_lint(index + 1, 'Opening curly brace `{` should be ' <<
                                'preceded by at least one space')
          end
        else
          line.scan(/[^"#'](?<![^ ] )\{/) do |match|
            add_lint(index + 1, 'Opening curly brace `{` should be ' <<
                                'preceded by one space')
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scss-lint-0.22.0 lib/scss_lint/linter/space_before_brace.rb