Sha256: 0a9268f26177e95bd6ee2e293f1aae6d2119e07a2b5dbf9d75bab7b6d4495f72

Contents?: true

Size: 600 Bytes

Versions: 4

Compression:

Stored size: 600 Bytes

Contents

# frozen_string_literal: true

require 'json'

module TaintedLove
  module Reporter
    # Reporter that outputs warnings into a JSON file
    class FileReporter < Base
      attr_reader :file_path

      def initialize(file_path = '/tmp/tainted_love.json')
        super()
        @file_path = file_path
      end

      def add_warning(warning)
        super(warning)

        update_file
      end

      def update_file
        report = {
          'warnings': @warnings,
          'application_path': Dir.pwd,
        }

        File.write(@file_path, report.to_json)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tainted_love-0.4.1 lib/tainted_love/reporter/file_reporter.rb
tainted_love-0.4.0 lib/tainted_love/reporter/file_reporter.rb
tainted_love-0.1.5 lib/tainted_love/reporter/file_reporter.rb
tainted_love-0.1.4 lib/tainted_love/reporter/file_reporter.rb