<commit_before>module StyleGuide
  class Scss < Base
    DEFAULT_CONFIG_FILENAME = "scss.yml"

    def violations_in_file(file)
      require "scss_lint"

      if config.excluded_file?(file.filename)
        []
      else
        runner.run([file.content])

        runner.lints.map do |violation|
          line = file.line_at(violation.location)

          Violation.new(
            filename: file.filename,
            line: line,
            line_number: violation.location,
            messages: [violation.description],
            patch_position: line.patch_position,
          )
        end
      end
    end

    private

    def runner
      @runner ||= SCSSLint::Runner.new(config)
    end

    def config
      SCSSLint::Config.new(custom_options || default_options)
    end

    def custom_options
      if options = repo_config.for(name)
        merge(default_options, options)
      end
    end<commit_msg>Fix line numbers for SCSS linter<commit_after>module StyleGuide
  class Scss < Base
    DEFAULT_CONFIG_FILENAME = "scss.yml"

    def violations_in_file(file)
      require "scss_lint"

      if config.excluded_file?(file.filename)
        []
      else
        runner.run([file.content])

        runner.lints.map do |violation|
          line = file.line_at(violation.location.line)

          Violation.new(
            filename: file.filename,
            line: line,
            line_number: violation.location.line,
            messages: [violation.description],
            patch_position: line.patch_position,
          )
        end
      end
    end

    private

    def runner
      @runner ||= SCSSLint::Runner.new(config)
    end

    def config
      SCSSLint::Config.new(custom_options || default_options)
    end

    def custom_options
      if options = repo_config.for(name)
        merge(default_options, options)
      end
    end
{'fraction_non_alphanumeric': 0.08213333333333334, 'fraction_numerical': 0.0, 'mean_word_length': 2.0258064516129033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '336958', 'n_tokens_mistral': 560, 'n_tokens_neox': 539, 'n_words': 112}