Sha256: 5483fe6cdad24b59bebbe87545df78a8341686c5168eb2e7160e4c3221e0a3ac

Contents?: true

Size: 669 Bytes

Versions: 2

Compression:

Stored size: 669 Bytes

Contents

require 'json'

module SCSSLint
  # Reports lints in a JSON format.
  class Reporter::JSONReporter < Reporter
    def report_lints
      output = {}
      lints.group_by(&:filename).each do |filename, file_lints|
        output[filename] = file_lints.map do |lint|
          issue = {}
          issue['linter'] = lint.linter.name if lint.linter
          issue['line'] = lint.location.line
          issue['column'] = lint.location.column
          issue['length'] = lint.location.length
          issue['severity'] = lint.severity
          issue['reason'] = lint.description
          issue
        end
      end
      JSON.pretty_generate(output)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scss-lint-0.30.0 lib/scss_lint/reporter/json_reporter.rb
scss-lint-0.29.0 lib/scss_lint/reporter/json_reporter.rb