Sha256: ecd0e510dac338e662225777ee8acac3a8024fb2ba00a7a83d840e0759d572de

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

require 'plist'
require 'rexml/document'

module IosAnalytics
  module Translate
    def trans(checkstyle_dom, plist_file)
      puts plist_file
      result = Plist::parse_xml(plist_file)
      return nil if result['files'].empty?

      file_path = result['files'][0]
      result['diagnostics'].each do |diagnostics|
        create_element(checkstyle_dom, file_path, diagnostics)
      end

      checkstyle_dom
    end

    def create_element(checkstyle_dom, file_path, diagnostics)
      file = checkstyle_dom.add_element('file',
                                        'name' => file_path
                                       )
      file.add_element('error',
                       'line' => diagnostics['location']['line'],
                       'severity' => 'error',
                       'message' => "#{diagnostics['category']}\n#{diagnostics['description']}"
                      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ios_analytics-0.0.3 lib/ios_analytics/translate.rb
ios_analytics-0.0.2 lib/ios_analytics/translate.rb