Module: IosAnalytics::Translate

Included in:
CLI
Defined in:
lib/ios_analytics/translate.rb

Instance Method Summary collapse

Instance Method Details

#create_element(checkstyle_dom, file_path, diagnostics) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/ios_analytics/translate.rb', line 18

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

#trans(checkstyle_dom, plist_file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ios_analytics/translate.rb', line 6

def trans(checkstyle_dom, 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